LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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
movl 0x80(%rsp), %ebp
movq %rsi, %r15
leaq 0x8(%rsp), %rdi
movq %r9, %rsi
movq %r9, %rbx
movl %r8d, %r14d
movl %ecx, %r12d
movl %ebp, %edx
callq 0x4496
testl %eax, %eax
je 0x8c81
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0xb730
leaq 0xc66f(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0x8cf5
leaq 0xc667(%rip), %rax      # 0x152d0
leaq 0x61cc(%rip), %rsi      # 0xee3c
movq (%rax), %rcx
pushq $0x1
popq %rdi
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq *%rcx
jmp 0x8cf5
movq 0x90(%rsp), %r13
movq %r13, %rdi
callq 0x23b0
movslq 0x28(%r13), %rax
movq 0x30(%r13), %rbp
movl %r14d, 0x4(%rsp)
movq %r13, %rdi
imulq $0x30, %rax, %r14
incl %eax
movl %eax, 0x28(%r13)
callq 0x2190
movq (%r15), %rax
movq 0x8(%r15), %rcx
movl 0x4(%rsp), %edx
movq %rcx, 0x8(%rbp,%r14)
movq %rax, (%rbp,%r14)
movl 0x80(%rsp), %ecx
movl 0x10(%r15), %eax
movl %eax, 0x10(%rbp,%r14)
movl %r12d, 0x14(%rbp,%r14)
movl %edx, 0x18(%rbp,%r14)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rbp,%r14)
movl %ecx, 0x28(%rbp,%r14)
movl 0x80(%rsp), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4366
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_O2/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 0x8d60
cmpq $0x0, 0x30(%rdi)
movq %rdi, %rbx
je 0x8d60
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
cmpq %rax, %r15
jge 0x8d66
movq 0x20(%rdi,%r14), %rax
movl 0x28(%rdi,%r14), %esi
movq %rax, %rdi
callq 0x4366
movq 0x30(%rbx), %rax
movq 0x20(%rax,%r14), %rdi
callq 0x22c0
incq %r15
addq $0x30, %r14
jmp 0x8d2a
popq %rbx
popq %r14
popq %r15
retq
callq 0x22c0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x22c0
// File: /workspace/github_c_makefile_star2_O2/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
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movq %r8, (%rsp)
pushq $0x38
popq %rdi
callq 0x22e0
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x8e1f
movslq %ebp, %rcx
movq %rax, %r15
imulq $0x30, %rcx, %rdi
callq 0x22e0
testq %rax, %rax
movq %rax, 0x30(%r15)
je 0x8e0d
movq %r15, %rdi
xorl %esi, %esi
callq 0x2400
andl $0x0, 0x28(%r15)
subq $0x8, %rsp
leaq -0x1c3(%rip), %rax      # 0x8c11
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r15
pushq %rax
pushq $0x1
callq 0x88b4
addq $0x20, %rsp
movq %r15, %rdi
movl %eax, %ebp
callq 0x22b0
cmpl $-0x1, %ebp
je 0x8e17
movq (%rsp), %rax
xorl %ebx, %ebx
movq %r15, (%rax)
jmp 0x8e1f
movq %r15, %rdi
callq 0x22c0
jmp 0x8e1f
movq %r15, %rdi
callq 0x8d10
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_O2/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 0xe5d4(%rip), %rax      # 0x17430
pushq $0x1
popq %rbx
movl %ebx, %ecx
lock
xaddl %ecx, (%rax)
testl %ecx, %ecx
je 0x8e76
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %ebp
pushq $0x78
popq %rdi
movl %ebx, %esi
callq 0xbe10
testl %ebp, %ebp
movq %rax, 0xe5ad(%rip)      # 0x17438
jle 0x8ec2
cmpl $0x7, %ebp
movl %ebp, %ebx
jb 0x8ec2
leaq 0xc42d(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0x8ebf
leaq 0xc429(%rip), %rax      # 0x152d0
leaq 0x5fb9(%rip), %rsi      # 0xee67
movq (%rax), %rcx
pushq $0x1
popq %rdi
pushq $0x6
popq %rbx
movl %ebx, %edx
xorl %eax, %eax
callq *%rcx
jmp 0x8ec2
pushq $0x6
popq %rbx
movl %ebx, 0xe578(%rip)      # 0x17440
movl %ebx, %r15d
leaq 0xe57e(%rip), %rbx      # 0x17450
leaq 0x1b(%rip), %r14        # 0x8ef4
subq $0x1, %r15
jb 0x8e69
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x24e0
addq $0x8, %rbx
jmp 0x8ed9
// File: /workspace/github_c_makefile_star2_O2/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, 0xdb8e(%rip)      # 0x17440
jle 0x9967
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
leaq 0xdada(%rip), %rax      # 0x173a4
movl (%rax), %ebx
callq 0x23a0
cmpl %eax, %ebx
jne 0x995c
movq %rsp, %rbx
xorps %xmm0, %xmm0
xorl %ebp, %ebp
andq $0x0, 0x70(%rbx)
movaps %xmm0, 0x60(%rbx)
movaps %xmm0, 0x50(%rbx)
movaps %xmm0, 0x40(%rbx)
movaps %xmm0, 0x30(%rbx)
movaps %xmm0, 0x20(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
movl 0xdb39(%rip), %eax      # 0x17440
cmpl %eax, %ebp
jge 0x991e
movq 0xdb26(%rip), %rdi      # 0x17438
movq %rbx, %rsi
callq 0xc01b
incl %ebp
jmp 0x9901
leaq 0xdb2b(%rip), %rbx      # 0x17450
xorl %r14d, %r14d
cltq
cmpq %rax, %r14
jge 0x9948
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x2220
movl 0xdb01(%rip), %eax      # 0x17440
incq %r14
addq $0x8, %rbx
jmp 0x9928
movq 0xdae9(%rip), %rdi      # 0x17438
callq 0xbe9d
andq $0x0, 0xdadc(%rip)      # 0x17438
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
cmpl $0x0, 0xd60a(%rip)      # 0x174a8
je 0x9eec
movl %edi, %ebx
cmpl $0x20, %esi
pushq $0x20
popq %rax
cmovbl %esi, %eax
cmpl 0xd5fb(%rip), %eax      # 0x174ac
jbe 0x9f14
movl 0xd5f2(%rip), %r12d     # 0x174ac
movl %eax, %r13d
leaq 0xd5ec(%rip), %rax      # 0x174b0
leaq 0x63(%rip), %r15        # 0x9f2e
leaq (%rax,%r12,8), %r14
cmpq %r13, %r12
jae 0x9f1a
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x24e0
incq %r12
addq $0x8, %r14
jmp 0x9ecf
leaq 0xb3d5(%rip), %rax      # 0x152c8
pushq $-0x1
popq %rbx
cmpl $0x0, (%rax)
js 0x9f22
leaq 0xb3ce(%rip), %rax      # 0x152d0
leaq 0x52f5(%rip), %rsi      # 0xf1fe
xorl %edi, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0x9f22
movl %eax, 0xd592(%rip)      # 0x174ac
movl %ebx, 0xd578(%rip)      # 0x17498
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0xd076(%rip), %r14      # 0x17480
cmpq $0x0, (%r14)
je 0xa48d
leaq 0xcf8d(%rip), %rax      # 0x173a4
movl (%rax), %ebx
callq 0x23a0
cmpl %eax, %ebx
jne 0xa48d
pushq $0x1
popq %rdi
pushq $0x30
popq %rsi
callq 0x2170
orl $-0x1, 0x20(%rax)
movq %rsp, %rbx
xorl %ebp, %ebp
movq %rax, (%rbx)
cmpl 0xd06d(%rip), %ebp      # 0x174ac
jae 0xa450
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xc01b
incl %ebp
jmp 0xa439
leaq 0xd059(%rip), %rbx      # 0x174b0
xorl %r15d, %r15d
movl 0xd04c(%rip), %eax      # 0x174ac
cmpq %rax, %r15
jae 0xa478
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x2220
incq %r15
addq $0x8, %rbx
jmp 0xa45a
movq (%rsp), %rdi
callq 0x22c0
movq (%r14), %rdi
callq 0xbe9d
andq $0x0, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_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 0xaef2
cmpl $0x82, %ebx
jne 0xaecb
movq %r14, %rdi
callq 0x21f0
xorl %ebx, %ebx
jmp 0xaef2
leaq 0xa3f6(%rip), %rax      # 0x152c8
pushq $-0x1
popq %rbx
cmpl $0x0, (%rax)
jle 0xaef2
leaq 0xa3ef(%rip), %rax      # 0x152d0
leaq 0x4634(%rip), %rsi      # 0xf51c
movq (%rax), %rcx
pushq $0x1
popq %rdi
xorl %eax, %eax
callq *%rcx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movq 0xc68e(%rip), %rcx      # 0x17600
xorl %esi, %esi
movl 0x8(%rcx), %edx
addq $0x38, %rcx
movq %rcx, %r8
testl %edx, %edx
cmovlel %esi, %edx
xorl %r9d, %r9d
cmpq %rdx, %r9
je 0xafd8
imulq $0x2f9068, %r9, %r10    # imm = 0x2F9068
movq %r8, %r11
leaq (%rcx,%r10), %rax
movl 0x68(%rcx,%r10), %r10d
testl %r10d, %r10d
cmovlel %esi, %r10d
incq %r10
decq %r10
je 0xafcc
movdqu (%r11), %xmm1
movdqu (%rdi), %xmm0
addq $0x10, %r11
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %ebx
cmpl $0xffff, %ebx           # imm = 0xFFFF
jne 0xafa8
jmp 0xafda
incq %r9
addq $0x2f9068, %r8          # imm = 0x2F9068
jmp 0xaf86
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xc5e2(%rip), %rdi      # 0x17618
testq %rdi, %rdi
je 0xb04d
pushq %rax
callq 0x22c0
andq $0x0, 0xc5cf(%rip)      # 0x17618
addq $0x8, %rsp
andl $0x0, 0xc5cc(%rip)      # 0x17620
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0xc51b(%rip), %rax      # 0x175d8
movq %rdx, %rbx
movq %rsi, %r15
cmpb $0x1, (%rax)
jne 0xb124
callq 0xaf10
testq %rax, %rax
je 0xb124
movq %rax, %rdi
movq %rax, %r14
callq 0xae9e
leaq 0x8(%rbx), %rdi
leaq 0x70(%r14), %rsi
pushq $0x14
popq %rdx
callq 0xb090
movl 0x6c(%r14), %eax
movq %r14, %rdi
addq $0x84, %rdi
movl %eax, 0x28(%rbx)
callq 0x24f0
movq %rax, (%rbx)
movq %rax, 0x20(%rbx)
movq %r14, %rdi
movb 0x2f9067(%r14), %al
movb %al, 0x2c(%rbx)
callq 0xaefc
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xb134
// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
xorl %eax, %eax
movq %rsi, %rbx
movl $0x2710, %r9d           # imm = 0x2710
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
movb %al, 0x8(%rsi)
andl $0x0, 0x28(%rsi)
andq $0x0, 0x20(%rsi)
movb %al, 0x2c(%rsi)
leaq 0x4562(%rip), %rsi      # 0xf6cd
movq %rbx, %rdx
callq 0xdbd7
testl %eax, %eax
je 0xb183
movb $0x1, 0x2c(%rbx)
pushq $-0x1
popq %rax
jmp 0xb251
movq (%rbx), %rbp
leaq 0x8(%rbx), %rax
leaq 0x10(%rsp), %r15
movq %rsp, %r12
leaq 0x3d43(%rip), %r13      # 0xeedc
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xb260
testq %rax, %rax
je 0xb24f
movq 0x10(%rsp), %r14
movq %r13, %rsi
movq %rax, %rbp
movq %r14, %rdi
callq 0x2350
testl %eax, %eax
je 0xb21b
movq %r14, %rdi
leaq 0x451a(%rip), %rsi      # 0xf6f0
callq 0x2350
testl %eax, %eax
je 0xb231
movq %r14, %rdi
leaq 0x44fe(%rip), %rsi      # 0xf6e7
callq 0x2350
testl %eax, %eax
je 0xb242
leaq 0xa0cf(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0xb19e
leaq 0xa0cb(%rip), %rax      # 0x152d0
movq (%rax), %rcx
pushq $0x1
popq %rdi
leaq 0x44f3(%rip), %rsi      # 0xf705
movq %r14, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xb19e
movq (%rsp), %rsi
movq 0x8(%rsp), %rdi
pushq $0x14
popq %rdx
callq 0xb090
jmp 0xb19e
movq (%rsp), %rdi
callq 0x2440
movl %eax, 0x28(%rbx)
jmp 0xb19e
movq (%rsp), %rax
movq %rax, 0x20(%rbx)
jmp 0xb19e
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: get_name_value
static char*
get_name_value(char* p, char** name, char** value)
{
	if (*p == 0) {
		return 0;
	}

	*name = p;
	*value = 0;

	while ((*p) && (*p != '\n')) {
		if (*p == '\t') {
			*p = 0;
			*value = p + 1;
		}
		p++;
	}

	if (*value == 0) {
		*value = p;
	}

	if (*p == '\n') {
		*p = 0;
		p++;
	}
	return p;
}

// Assembly:
cmpb $0x0, (%rdi)
je 0xb2ab
movq %rdi, (%rsi)
andq $0x0, (%rdx)
movq %rdi, %rax
xorl %ecx, %ecx
movzbl (%rax), %esi
cmpl $0x9, %esi
je 0xb284
testl %esi, %esi
je 0xb293
cmpl $0xa, %esi
jne 0xb28e
jmp 0xb293
leaq 0x1(%rax), %rcx
movb $0x0, (%rax)
movq %rcx, (%rdx)
incq %rax
jmp 0xb271
testq %rcx, %rcx
jne 0xb29e
movq %rax, (%rdx)
movb (%rax), %sil
cmpb $0xa, %sil
jne 0xb2ad
movb $0x0, (%rax)
incq %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0xc310(%rip), %rax      # 0x175d8
movq %rdx, %rbx
movq %rsi, %r15
cmpb $0x1, (%rax)
jne 0xb38a
callq 0xaf10
testq %rax, %rax
je 0xb38a
movq %rax, %rdi
movq %rax, %r14
callq 0xae9e
leaq 0x1065(%r14), %rdi
movq %rdi, (%rsp)
callq 0x20e0
movq %r14, %r15
movq %rax, %r13
addq $0x17d066, %r15         # imm = 0x17D066
movq %r15, %rdi
callq 0x20e0
movq %rax, %rbp
leal 0x2(%rax,%r13), %eax
movslq %eax, %rdi
callq 0x22e0
movq (%rsp), %rsi
movslq %r13d, %r13
movq %rax, %rdi
movq %rax, (%rbx)
movq %rax, %r12
movq %rax, 0x8(%rbx)
movq %r13, %rdx
callq 0x21b0
leaq (%r12,%r13), %rax
leaq 0x1(%r12,%r13), %rdi
movq %r15, %rsi
xorl %r12d, %r12d
movq %rax, (%rsp)
xorl %eax, %eax
movb %al, -0x1(%rdi)
movq %rdi, 0x10(%rbx)
movslq %ebp, %rbx
movq %rbx, %rdx
callq 0x21b0
movq (%rsp), %rax
movq %r14, %rdi
movb %r12b, 0x1(%rbx,%rax)
callq 0xaefc
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 0xb3a3
// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
andq $0x0, 0x10(%rsi)
andq $0x0, 0x8(%rsi)
movq %rsi, %rbx
leaq 0x4355(%rip), %rsi      # 0xf71a
movl $0x1e8480, %r9d         # imm = 0x1E8480
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
movq %rbx, %rdx
callq 0xdbd7
testl %eax, %eax
je 0xb3e7
pushq $-0x1
popq %rax
jmp 0xb482
movq (%rbx), %rbp
leaq 0x8(%rbx), %rax
leaq 0x10(%rsp), %r14
movq %rsp, %r15
leaq 0x432b(%rip), %r12      # 0xf728
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xb260
testq %rax, %rax
je 0xb480
movq 0x10(%rsp), %r13
movq %r12, %rsi
movq %rax, %rbp
movq %r13, %rdi
callq 0x2350
testl %eax, %eax
je 0xb468
movq %r13, %rdi
leaq 0x4301(%rip), %rsi      # 0xf737
callq 0x2350
testl %eax, %eax
je 0xb476
leaq 0x9e82(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0xb402
leaq 0x9e7e(%rip), %rax      # 0x152d0
movq (%rax), %rcx
pushq $0x1
popq %rdi
leaq 0x42e6(%rip), %rsi      # 0xf745
movq %r13, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xb402
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
jmp 0xb402
movq (%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0xb402
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/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
leaq 0xc133(%rip), %rax      # 0x175d8
movq %rsi, %rbx
movq %rdi, %r15
cmpb $0x1, (%rax)
jne 0xb4ea
movq %r15, %rdi
callq 0xaf6a
testq %rax, %rax
je 0xb4ea
movq %rax, %rdi
movq %rax, %r14
callq 0xae9e
movq %r14, %rsi
addq $0x70, %rsi
pushq $0x14
popq %rdx
movq %rbx, %rdi
callq 0xb090
movq %r14, %rdi
callq 0xaefc
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xb4fa
// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
movq %rsi, %rbx
movb $0x0, (%rsi)
leaq 0x39c7(%rip), %rsi      # 0xeedc
movq %rsp, %rdx
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
callq 0xdbd2
testl %eax, %eax
je 0xb531
pushq $-0x1
popq %rax
jmp 0xb5b6
movq (%rsp), %r13
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x3996(%rip), %r12      # 0xeedc
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xb260
testq %rax, %rax
je 0xb5ab
movq 0x10(%rsp), %rbp
movq %r12, %rsi
movq %rax, %r13
movq %rbp, %rdi
callq 0x2350
testl %eax, %eax
je 0xb599
leaq 0x9d51(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0xb546
leaq 0x9d4d(%rip), %rax      # 0x152d0
movq (%rax), %rcx
pushq $0x1
popq %rdi
leaq 0x41ce(%rip), %rsi      # 0xf75e
movq %rbp, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xb546
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
pushq $0x14
popq %rdx
callq 0xb090
jmp 0xb546
movq (%rsp), %rdi
callq 0x22c0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/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
leaq 0xc008(%rip), %rax      # 0x175d8
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, (%rax)
jne 0xb5f2
xorl %eax, %eax
callq 0xaf05
testl %eax, %eax
jle 0xb5f2
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 0xb604
// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
andl $0x0, (%rsi)
movq %rsi, %rbx
leaq 0x4154(%rip), %rsi      # 0xf773
movq %rsp, %rdx
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
callq 0xdbd2
testl %eax, %eax
je 0xb63b
pushq $-0x1
popq %rax
jmp 0xb6bc
movq (%rsp), %r13
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x4123(%rip), %r12      # 0xf773
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xb260
testq %rax, %rax
je 0xb6b1
movq 0x10(%rsp), %rbp
movq %r12, %rsi
movq %rax, %r13
movq %rbp, %rdi
callq 0x2350
testl %eax, %eax
je 0xb6a3
leaq 0x9c47(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0xb650
leaq 0x9c43(%rip), %rax      # 0x152d0
movq (%rax), %rcx
pushq $0x1
popq %rdi
leaq 0x40e4(%rip), %rsi      # 0xf77e
movq %rbp, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xb650
movq 0x8(%rsp), %rdi
callq 0x2440
movl %eax, (%rbx)
jmp 0xb650
movq (%rsp), %rdi
callq 0x22c0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_alloc.c
// Function: cf_client_rc_release_x
cf_atomic_int_t
cf_client_rc_release_x(void *addr, bool autofree)
{
	cf_client_rc_counter *rc;
	uint64_t c;
	
	/* Release the reservation; if this reduced the reference count to zero,
	 * then free the block if autofree is set, and return 1.  Otherwise,
	 * return 0 */
	rc = (cf_client_rc_counter *) (((uint8_t *)addr) - sizeof(cf_client_rc_counter));
	smb_mb();
	if (0 == (c = cf_atomic32_decr(rc)))
		if (autofree)
			free((void *)rc);

	return (cf_atomic_int_t)c;
}

// Assembly:
pushq %rbx
mfence
xorb $0x1, %sil
pushq $-0x1
popq %rbx
lock
xaddl %ebx, -0x4(%rdi)
decl %ebx
setne %al
orb %sil, %al
jne 0xb701
addq $-0x4, %rdi
callq 0x22c0
movslq %ebx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x14
popq %r12
leaq 0x4073(%rip), %r15      # 0xf7c5
testq %r12, %r12
je 0xb773
movzbl 0x14(%r14,%r12), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2070
incq %r12
addq $0x2, %rbx
jmp 0xb752
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xba2e
andq $0x0, 0x8(%rdi)
andq $0x0, (%rdi)
jmp 0xba66
cmpq %rsi, (%rdi)
je 0xba4d
cmpq %rsi, 0x8(%rdi)
je 0xba5a
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
movq %rax, (%rcx)
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rax)
jmp 0xba66
movq (%rsi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rax)
jmp 0xba66
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
andq $0x0, (%rax)
decl 0x18(%rdi)
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0xba77
movq %rsi, %rdi
jmpq *%rax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xbabb
cmpb $0x1, 0x1c(%rdi)
movq %rsi, %r14
movq %rdi, %rbx
jne 0xba97
leaq 0x20(%rbx), %rdi
callq 0x23b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xba1d
cmpb $0x1, 0x1c(%rbx)
jne 0xbabb
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_O2/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
cmpb $0x1, 0x1c(%rdi)
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
jne 0xbae8
leaq 0x20(%rbx), %rdi
callq 0x23b0
xorb $0x1, %bpl
movq %rbx, (%rsp)
movzbl %bpl, %r13d
xorl %ebp, %ebp
shll $0x3, %r13d
movq (%rbx,%r13), %r12
testq %r12, %r12
je 0xbb32
movq %r12, %rdi
movq %r14, %rsi
callq *%r15
movl %eax, %ebp
testl %eax, %eax
je 0xbb2c
cmpl $0x1, %ebp
jne 0xbb32
movq (%rsp), %rdi
movq (%r12,%r13), %rbx
movq %r12, %rsi
callq 0xba1d
movq %rbx, %r12
jmp 0xbafe
movq (%r12,%r13), %r12
jmp 0xbafe
movq (%rsp), %rdi
cmpb $0x1, 0x1c(%rdi)
jne 0xbb45
addq $0x20, %rdi
callq 0x2190
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_ll.c
// Function: cf_ll_insert_reduce
int
cf_ll_insert_reduce(cf_ll *ll, cf_ll_element *e, 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_INSERT) {

				if (forward)
					cf_ll_insert_before_lockfree(ll, cur, e);
				else
					cf_ll_insert_after_lockfree(ll, cur, e);
				rv = 0;
				
			}
			
			goto Exit;
			
		}
		else {
			cur = forward ? cur->next : cur->prev;
		}
	}
	
	// give chance to insert at "end"
	if ( (rv = (*fn) (cur, udata) ) ) {
		if (rv == CF_LL_REDUCE_INSERT) {
			if (forward)
				cf_ll_append_lockfree(ll, e);
			else
				cf_ll_prepend_lockfree(ll, e);
			rv = 0;
		}
	}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpb $0x1, 0x1c(%rdi)
movq %r8, %r12
movq %rcx, %r15
movl %edx, %ebx
movq %rdi, %r14
movq %rsi, 0x10(%rsp)
jne 0xbb83
leaq 0x20(%r14), %rdi
callq 0x23b0
movl %ebx, %eax
movl %ebx, 0xc(%rsp)
movq %r14, %rbx
xorb $0x1, %al
movzbl %al, %ebp
shll $0x3, %ebp
movq (%rbx,%rbp), %rbx
testq %rbx, %rbx
je 0xbbcb
movq %rbx, %rdi
movq %r12, %rsi
callq *%r15
testl %eax, %eax
je 0xbb94
movl %eax, %r13d
cmpl $0x2, %eax
jne 0xbc13
cmpb $0x0, 0xc(%rsp)
je 0xbbf1
movq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb9b8
jmp 0xbc10
xorl %edi, %edi
movq %r12, %rsi
callq *%r15
movl %eax, %r13d
cmpl $0x2, %eax
jne 0xbc13
cmpb $0x0, 0xc(%rsp)
je 0xbc03
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0xb8dd
jmp 0xbc10
movq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb951
jmp 0xbc10
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0xb868
xorl %r13d, %r13d
cmpb $0x1, 0x1c(%r14)
jne 0xbc26
addq $0x20, %r14
movq %r14, %rdi
callq 0x2190
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_ll.c
// Function: cf_ll_size
uint32_t
cf_ll_size(cf_ll *ll)
{
	LL_LOCK(ll);
	
	uint32_t sz = ll->sz;
	
	LL_UNLOCK(ll);
	
	return(sz);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movb 0x1c(%rdi), %al
movq %rdi, %rbx
cmpb $0x1, %al
jne 0xbc51
leaq 0x20(%rbx), %rdi
callq 0x23b0
movb 0x1c(%rbx), %al
movl 0x18(%rbx), %ebp
testb $0x1, %al
je 0xbc64
addq $0x20, %rbx
movq %rbx, %rdi
callq 0x2190
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_log.c
// Function: cf_default_log
static void
cf_default_log(cf_log_level level, const char* fmt_no_newline, ...)
{
	size_t fmt_size = strlen(fmt_no_newline) + 2;
	char* fmt = (char*)alloca(fmt_size);

	strncpy(fmt, fmt_no_newline, fmt_size);
	fmt[fmt_size - 2] = '\n';

	va_list ap;

	va_start(ap, fmt_no_newline);
	vfprintf(stderr, fmt, ap);
	va_end(ap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
leaq -0xf0(%rbp), %r12
movq %rsi, %rbx
testb %al, %al
movq %rdx, 0x10(%r12)
movq %rcx, 0x18(%r12)
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
je 0xbcf8
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
movq %rsi, %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x2(%rax), %rdx
addq $0x11, %rax
movq %rsp, %r15
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2130
leaq -0x40(%rbp), %rdx
leaq 0x10(%rbp), %rax
movabsq $0x3000000010, %rcx     # imm = 0x3000000010
movq %r15, %rsi
movb $0xa, (%r14,%r15)
movq %rax, 0x8(%rdx)
movq 0x9298(%rip), %rax      # 0x14fe0
movq %r12, 0x10(%rdx)
movq %rcx, (%rdx)
movq (%rax), %rdi
callq 0x22f0
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_proto.c
// Function: cl_proto_swap
void
cl_proto_swap(cl_proto *p)
{
	uint8_t	 version = p->version;
	uint8_t  type = p->type;
	p->version = p->type = 0;
	p->sz = cf_byteswap64p(p);
	p->version = version;
	p->type = type;
}

// Assembly:
movzwl (%rdi), %eax
andw $0x0, (%rdi)
movq (%rdi), %rcx
bswapq %rcx
movl %ecx, 0x2(%rdi)
shrq $0x20, %rcx
movw %cx, 0x6(%rdi)
movw %ax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_proto.c
// Function: cl_msg_swap_header
void
cl_msg_swap_header(cl_msg *m)
{
	m->generation = ntohl(m->generation);
	m->record_ttl =  ntohl(m->record_ttl);
	m->transaction_ttl = ntohl(m->transaction_ttl);
	m->n_fields = ntohs(m->n_fields);
	m->n_ops= ntohs(m->n_ops);
}

// Assembly:
movl 0x6(%rdi), %eax
movl 0xa(%rdi), %ecx
bswapl %eax
bswapl %ecx
movl %eax, 0x6(%rdi)
movl %ecx, 0xa(%rdi)
movl 0xe(%rdi), %eax
bswapl %eax
movl %eax, 0xe(%rdi)
rolw $0x8, 0x12(%rdi)
rolw $0x8, 0x14(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_proto.c
// Function: cl_msg_swap_fields
void
cl_msg_swap_fields(cl_msg *m)
{
	cl_msg_field *mf = (cl_msg_field *) m->data;

	for (int i=0;i<m->n_fields;i++) {
		cl_msg_swap_field(mf);
		mf = cl_msg_field_get_next(mf);
	}
}

// Assembly:
leaq 0x16(%rdi), %rax
xorl %ecx, %ecx
movzwl 0x12(%rdi), %edx
cmpl %edx, %ecx
jae 0xbdd8
movl (%rax), %edx
incl %ecx
bswapl %edx
movl %edx, (%rax)
leaq 0x4(%rax,%rdx), %rax
jmp 0xbdc1
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_proto.c
// Function: cl_msg_swap_fields_and_ops
void
cl_msg_swap_fields_and_ops(cl_msg *m)
{
	cl_msg_field *mf = (cl_msg_field *) m->data;

	for (int i=0;i<m->n_fields;i++) {
		cl_msg_swap_field(mf);
		mf = cl_msg_field_get_next(mf);
	}

	cl_msg_op *op = (cl_msg_op *)mf;
	for (int i=0;i<m->n_ops;i++) {
		cl_msg_swap_op(op);
		op = cl_msg_op_get_next(op);
	}
}

// Assembly:
leaq 0x16(%rdi), %rax
xorl %ecx, %ecx
movzwl 0x12(%rdi), %edx
cmpl %edx, %ecx
jae 0xbdf6
movl (%rax), %edx
incl %ecx
bswapl %edx
movl %edx, (%rax)
leaq 0x4(%rax,%rdx), %rax
jmp 0xbddf
xorl %ecx, %ecx
movzwl 0x14(%rdi), %edx
cmpl %edx, %ecx
jae 0xbe0f
movl (%rax), %edx
incl %ecx
bswapl %edx
movl %edx, (%rax)
leaq 0x4(%rax,%rdx), %rax
jmp 0xbdf8
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_queue.c
// Function: cf_queue_destroy
void
cf_queue_destroy(cf_queue *q)
{
	if (q->threadsafe) {
#ifdef EXTERNAL_LOCKS
		cf_hooked_mutex_free(q->LOCK);
#else
		pthread_cond_destroy(&q->CV);
		pthread_mutex_destroy(&q->LOCK);
#endif // EXTERNAL_LOCKS
	}
	memset((void*)q->queue, 0, q->allocsz * q->elementsz);
	free(q->queue);
	memset((void*)q, 0, sizeof(cf_queue) );
	free(q);
}

// Assembly:
pushq %rbx
cmpb $0x1, (%rdi)
movq %rdi, %rbx
jne 0xbeb8
leaq 0x40(%rbx), %rdi
callq 0x2530
leaq 0x18(%rbx), %rdi
callq 0x22b0
movl 0x4(%rbx), %edx
movq 0x70(%rbx), %rdi
xorl %esi, %esi
imulq 0x10(%rbx), %rdx
callq 0x2140
movq 0x70(%rbx), %rdi
callq 0x22c0
movq %rbx, %rdi
popq %rbx
jmp 0x22c0
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_queue.c
// Function: cf_queue_sz
int
cf_queue_sz(cf_queue *q)
{
	int rv;

	QUEUE_LOCK(q);
	rv = CF_Q_SZ(q);
	QUEUE_UNLOCK(q);

	return(rv);
	
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movb (%rdi), %al
movq %rdi, %rbx
cmpb $0x1, %al
jne 0xbef5
leaq 0x18(%rbx), %rdi
callq 0x23b0
movb (%rbx), %al
movl 0x8(%rbx), %ebp
movl 0xc(%rbx), %r14d
testb $0x1, %al
je 0xbf0c
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x2190
subl %r14d, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_queue.c
// Function: cf_queue_resize
int
cf_queue_resize(cf_queue *q, uint32_t new_sz)
{
	// check - a lot of the code explodes badly if queue is not full
	if (CF_Q_SZ(q) != q->allocsz) {
//		cf_debug(CF_QUEUE,"cf_queue: internal error: resize on non-full queue");
		return(-1);
	}
	
	// the rare case where the queue is not fragmented, and realloc makes sense
	// and none of the offsets need to move
	if (0 == q->read_offset % q->allocsz) {
		q->queue = (uint8_t*)realloc(q->queue, new_sz * q->elementsz);
		if (!q->queue) {
//			cf_debug(CF_QUEUE," pfft! out of memory! crash!");
			return(-1);
		}
		q->read_offset = 0;
		q->write_offset = q->allocsz;
	}
	else {
		
		uint8_t *newq = (uint8_t*)malloc(new_sz * q->elementsz);
		if (!newq) {
//			cf_debug(CF_QUEUE," pffth! out of memory! crash!");
			return(-1);
		}
		// endsz is used uint8_ts in the old queue from the insert point to the end
		uint32_t endsz = (uint32_t)((q->allocsz - (q->read_offset % q->allocsz)) * q->elementsz);
		memcpy(&newq[0], CF_Q_ELEM_PTR(q, q->read_offset), endsz);
		memcpy(&newq[endsz], &q->queue[0], (q->allocsz * q->elementsz) - endsz); 
		
		free(q->queue);
		q->queue = newq;

		q->write_offset = q->allocsz;
		q->read_offset = 0;
	}

	q->allocsz = new_sz;
	return(0);	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x8(%rdi), %ebx
movl 0xc(%rdi), %eax
subl %eax, %ebx
pushq $-0x1
popq %rbp
cmpl 0x4(%rdi), %ebx
jne 0xbff4
xorl %edx, %edx
movl %esi, %r13d
movq %rdi, %r14
divl %ebx
testl %edx, %edx
je 0xbfc7
movq 0x10(%r14), %r15
movl %r13d, %edi
movl %edx, %r12d
imulq %r15, %rdi
callq 0x22e0
testq %rax, %rax
je 0xbff4
movq 0x70(%r14), %rbp
movl %ebx, %ecx
movl %r12d, %esi
movl %r13d, 0x4(%rsp)
movl %r15d, %r13d
movq %rax, %rdi
subl %r12d, %ecx
imulq %r15, %rsi
movq %rax, %r12
imull %ecx, %r13d
movq %r13, %rdx
addq %rbp, %rsi
callq 0x21b0
movl %ebx, %edx
movq %r12, %rdi
movq %rbp, %rsi
imulq %r15, %rdx
addq %r13, %rdi
subq %r13, %rdx
movl 0x4(%rsp), %r13d
callq 0x21b0
movq %rbp, %rdi
callq 0x22c0
movq %r12, 0x70(%r14)
movl 0x4(%r14), %eax
movl %eax, 0x8(%r14)
andl $0x0, 0xc(%r14)
jmp 0xbfee
movl %r13d, %esi
movq 0x70(%r14), %rdi
imulq 0x10(%r14), %rsi
callq 0x2470
testq %rax, %rax
movq %rax, 0x70(%r14)
je 0xbff4
andl $0x0, 0xc(%r14)
movl 0x4(%r14), %eax
movl %eax, 0x8(%r14)
xorl %ebp, %ebp
movl %r13d, 0x4(%r14)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cf_queue.c
// Function: cf_queue_push
int
cf_queue_push(cf_queue *q, void *ptr)
{
	/* FIXME arg check - and how do you do that, boyo? Magic numbers? */

	/* FIXME error */

	QUEUE_LOCK(q);

	/* Check queue length */
	if (CF_Q_SZ(q) == q->allocsz) {
		/* resize is a pain for circular buffers */
		if (0 != cf_queue_resize(q, q->allocsz + CF_QUEUE_ALLOCSZ)) {
			QUEUE_UNLOCK(q);
			return(-1);
		}
	}

	// todo: if queues are power of 2, this can be a shift
	memcpy(CF_Q_ELEM_PTR(q,q->write_offset), ptr, q->elementsz);
	q->write_offset++;
	// we're at risk of overflow if the write offset is that high
	if (q->write_offset & 0xC0000000) cf_queue_unwrap(q);

#ifndef EXTERNAL_LOCKS	
	if (q->threadsafe)
		pthread_cond_signal(&q->CV);
#endif 

	QUEUE_UNLOCK(q);

	return(0);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpb $0x1, (%rdi)
movq %rsi, %r14
movq %rdi, %rbx
jne 0xc033
leaq 0x18(%rbx), %rdi
callq 0x23b0
movl 0x8(%rbx), %eax
movl 0x4(%rbx), %ecx
movl %eax, %esi
subl 0xc(%rbx), %esi
cmpl %ecx, %esi
jne 0xc061
addl $0x40, %esi
movq %rbx, %rdi
callq 0xbf16
testl %eax, %eax
je 0xc05b
pushq $-0x1
popq %rbp
cmpb $0x0, (%rbx)
jne 0xc0a9
jmp 0xc0b5
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %eax
xorl %edx, %edx
movq %r14, %rsi
divl %ecx
movl %edx, %edi
movq 0x10(%rbx), %rdx
imulq %rdx, %rdi
addq 0x70(%rbx), %rdi
callq 0x21b0
movl 0x8(%rbx), %eax
incl %eax
cmpl $0x40000000, %eax       # imm = 0x40000000
movl %eax, 0x8(%rbx)
jb 0xc092
movq %rbx, %rdi
callq 0xc005
movb (%rbx), %al
cmpb $0x1, %al
jne 0xc0a3
leaq 0x40(%rbx), %rdi
callq 0x2030
movb (%rbx), %al
xorl %ebp, %ebp
testb $0x1, %al
je 0xc0b5
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x2190
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq