// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/example/main.c
// Function: do_example
int
do_example(config *c)
{
	int rv;
	
	// Put some test values
	cl_object o_key;
	citrusleaf_object_init_str(&o_key, "example_key");
	cl_bin values[2];
	strcpy(values[0].bin_name, "test_bin_one");
	citrusleaf_object_init_str(&values[0].object, "example_value_one");
	strcpy(values[1].bin_name, "test_bin_two");
	citrusleaf_object_init_int(&values[1].object, 0xDEADBEEF);
	
	// set a non-default write parameter
	cl_write_parameters cl_wp;
	cl_write_parameters_set_default(&cl_wp);
	cl_wp.timeout_ms = 1000;
	
	if (0 != (rv = citrusleaf_put(c->asc, c->ns, c->set, &o_key, values, 2, &cl_wp))) {
		fprintf(stderr, "citrusleaf put failed: error %d\n",rv);
		return(-1);
	}
	fprintf(stderr, "citrusleaf put succeeded\n");
	
	// Get all the values in this key (enjoy the fine c99 standard)
	cl_bin *cl_v = 0;
	uint32_t generation;
	int 	cl_v_len;
	if (0 != (rv = citrusleaf_get_all(c->asc, c->ns, c->set, &o_key, &cl_v, &cl_v_len, c->timeout_ms, &generation))) {
		fprintf(stderr, "get after put failed, but there should be a key here - %d\n",rv);
		if (cl_v)	free(cl_v);
		return(-1);
	}
	fprintf(stderr, "get all returned %d bins\n",cl_v_len);
	for (int i=0;i<cl_v_len;i++) {
		fprintf(stderr, "%d:  bin %s ",i,cl_v[i].bin_name);
		switch (cl_v[i].object.type) {
			case CL_STR:
				fprintf(stderr, "type string: value %s\n", cl_v[i].object.u.str);
				break;
			case CL_INT:
				fprintf(stderr, "type int: value %"PRId64"\n",cl_v[i].object.u.i64);
				break;
			default:
				fprintf(stderr, "type unknown! (%d)\n",(int)cl_v[i].object.type);
				break;
		}
		// could have done this -- but let's free the objects in the bins later
		// citrusleaf_object_free(&cl_v[i].object);
	}
	if (cl_v)	{
		citrusleaf_bins_free(cl_v, cl_v_len);
		free(cl_v); // only one free for all bins
	}
	fprintf(stderr,"citrusleaf getall succeeded\n");
	
	// Delete the key you just set
	if (0 != (rv = citrusleaf_delete(c->asc, c->ns, c->set, &o_key, 0/*default write params*/))) {
		fprintf(stderr, "citrusleaf delete failed: error %d\n",rv);
		return(-1);
	}
	fprintf(stderr, "citrusleaf delete succeeded\n");
	
	return(0);
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x14a0a(%rip), %rsi     # 0x1a048
callq 0x5df0
leaq 0x40(%rsp), %rdi
leaq 0x14a05(%rip), %rsi     # 0x1a054
callq 0x5240
leaq 0x40(%rsp), %rdi
addq $0x20, %rdi
leaq 0x149fd(%rip), %rsi     # 0x1a061
callq 0x5df0
leaq 0x40(%rsp), %rdi
addq $0x40, %rdi
leaq 0x149fa(%rip), %rsi     # 0x1a073
callq 0x5240
leaq 0x40(%rsp), %rdi
addq $0x40, %rdi
addq $0x20, %rdi
movl $0xdeadbeef, %esi       # imm = 0xDEADBEEF
callq 0x5e90
leaq 0x28(%rsp), %rdi
callq 0x59f0
movl $0x3e8, 0x34(%rsp)      # imm = 0x3E8
movq 0xe8(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0xe8(%rsp), %rax
movq 0x18(%rax), %rdx
leaq 0x40(%rsp), %r8
leaq 0xc0(%rsp), %rcx
movl $0x2, %r9d
leaq 0x28(%rsp), %rax
movq %rax, (%rsp)
callq 0x8a40
movl %eax, %ecx
movl %ecx, 0xe4(%rsp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x572a
movq 0x1a8de(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movl 0xe4(%rsp), %edx
leaq 0x1496d(%rip), %rsi     # 0x1a080
movb $0x0, %al
callq 0x5380
movl $0xffffffff, 0xf4(%rsp) # imm = 0xFFFFFFFF
jmp 0x59dd
movq 0x1a8af(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x14966(%rip), %rsi     # 0x1a0a1
movb $0x0, %al
callq 0x5380
movq $0x0, 0x20(%rsp)
movq 0xe8(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0xe8(%rsp), %rax
movq 0x18(%rax), %rdx
movq 0xe8(%rsp), %rax
movl 0x24(%rax), %r10d
leaq 0xc0(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x18(%rsp), %r9
leaq 0x1c(%rsp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x98d0
movl %eax, %ecx
movl %ecx, 0xe4(%rsp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x57f0
movq 0x1a82a(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movl 0xe4(%rsp), %edx
leaq 0x148f4(%rip), %rsi     # 0x1a0bb
movb $0x0, %al
callq 0x5380
cmpq $0x0, 0x20(%rsp)
je 0x57e0
movq 0x20(%rsp), %rdi
callq 0x52b0
movl $0xffffffff, 0xf4(%rsp) # imm = 0xFFFFFFFF
jmp 0x59dd
movq 0x1a7e9(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movl 0x18(%rsp), %edx
leaq 0x148f1(%rip), %rsi     # 0x1a0f6
movb $0x0, %al
callq 0x5380
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x5911
movq 0x1a7b7(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movslq 0x14(%rsp), %rax
movl %eax, %edx
movq 0x20(%rsp), %rcx
shlq $0x6, %rax
addq %rax, %rcx
leaq 0x148ca(%rip), %rsi     # 0x1a110
xorl %eax, %eax
callq 0x5380
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
shlq $0x6, %rcx
movl 0x20(%rax,%rcx), %eax
movl %eax, 0x10(%rsp)
subl $0x1, %eax
je 0x58a4
jmp 0x586a
movl 0x10(%rsp), %eax
subl $0x3, %eax
jne 0x58d3
jmp 0x5875
movq 0x1a764(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rdx
leaq 0x14882(%rip), %rsi     # 0x1a11d
movb $0x0, %al
callq 0x5380
jmp 0x58ff
movq 0x1a735(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rdx
leaq 0x1486a(%rip), %rsi     # 0x1a134
movb $0x0, %al
callq 0x5380
jmp 0x58ff
movq 0x1a706(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x20(%rax), %edx
leaq 0x14851(%rip), %rsi     # 0x1a149
movb $0x0, %al
callq 0x5380
jmp 0x5901
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x5814
cmpq $0x0, 0x20(%rsp)
je 0x5931
movq 0x20(%rsp), %rdi
movl 0x18(%rsp), %esi
callq 0x6020
movq 0x20(%rsp), %rdi
callq 0x52b0
movq 0x1a6a8(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x1481b(%rip), %rsi     # 0x1a15d
movb $0x0, %al
callq 0x5380
movq 0xe8(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0xe8(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0xe8(%rsp), %rax
movq 0x18(%rax), %rdx
leaq 0xc0(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x9400
movl %eax, %ecx
movl %ecx, 0xe4(%rsp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x59ba
movq 0x1a64b(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movl 0xe4(%rsp), %edx
leaq 0x147d4(%rip), %rsi     # 0x1a17a
movb $0x0, %al
callq 0x5380
movl $0xffffffff, 0xf4(%rsp) # imm = 0xFFFFFFFF
jmp 0x59dd
movq 0x1a61f(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x147d3(%rip), %rsi     # 0x1a19e
movb $0x0, %al
callq 0x5380
movl $0x0, 0xf4(%rsp)
movl 0xf4(%rsp), %eax
addq $0xf8, %rsp
retq
nopl (%rax)