// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_client.c
// Function: proto_kvlds_request_cas
int
proto_kvlds_request_cas(struct wire_requestqueue * Q,
    const struct kvldskey * key, const struct kvldskey * oval,
    const struct kvldskey * value,
    int (* callback)(void *, int, int), void * cookie)
{
	struct donep_cookie * C;
	uint8_t * buf;
	size_t buflen;
	size_t bufpos;

	/* Bake a cookie. */
	if ((C = mpool_donep_malloc()) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;
	C->type = "CAS";

	/* Compute request size. */
	buflen = 4;
	buflen += kvldskey_serial_size(key);
	buflen += kvldskey_serial_size(oval);
	buflen += kvldskey_serial_size(value);

	/* Start writing a request. */
	if ((buf = wire_requestqueue_add_getbuf(Q, buflen,
	    callback_donep, C)) == NULL)
		goto err1;

	/* Construct request. */
	be32enc(&buf[0], PROTO_KVLDS_CAS);
	bufpos = 4;
	kvldskey_serialize(key, &buf[bufpos]);
	bufpos += kvldskey_serial_size(key);
	kvldskey_serialize(oval, &buf[bufpos]);
	bufpos += kvldskey_serial_size(oval);
	kvldskey_serialize(value, &buf[bufpos]);
	bufpos += kvldskey_serial_size(value);

	/* Sanity-check. */
	assert(bufpos == buflen);

	/* Finish writing request. */
	if (wire_requestqueue_add_done(Q, buf, buflen))
		goto err1;

	/* Success! */
	return (0);

err1:
	mpool_donep_free(C);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, %r14
movq %rdx, %r12
incq 0xbab5(%rip)            # 0x114a8
movq %rsi, %r13
movq 0xba93(%rip), %rax      # 0x11490
testq %rax, %rax
movq %rdi, (%rsp)
je 0x5a1f
movq 0xba93(%rip), %rcx      # 0x114a0
leaq -0x1(%rax), %rdx
movq %rdx, 0xba78(%rip)      # 0x11490
movq -0x8(%rcx,%rax,8), %r15
jmp 0x5a56
incq 0xba8a(%rip)            # 0x114b0
cmpl $0x0, 0xba8b(%rip)      # 0x114b8
jne 0x5a45
movq 0xba92(%rip), %rdi      # 0x114c8
callq 0xa050
movl $0x1, 0xba73(%rip)      # 0x114b8
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
movq (%rsp), %rdi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x5b47
movq %rbp, (%r15)
movq %rbx, 0x8(%r15)
leaq 0x5e8d(%rip), %rax      # 0xb8ff
movq %rax, 0x10(%r15)
movzbl (%r13), %eax
movzbl (%r12), %ecx
movzbl (%r14), %edx
addq %rax, %rcx
leaq (%rdx,%rcx), %rbx
addq $0x7, %rbx
leaq 0xdf(%rip), %rdx        # 0x5b75
movq %rbx, %rsi
movq %r15, %rcx
callq 0x6f4d
testq %rax, %rax
je 0x5b2f
movq %rax, %rbp
movl $0x11010000, (%rax)     # imm = 0x11010000
leaq 0x4(%rax), %rdi
movzbl (%r13), %edx
incq %rdx
movq %r13, %rsi
callq 0x2200
movzbl (%r13), %r13d
leaq 0x5(,%r13), %rdi
addq %rbp, %rdi
movzbl (%r12), %edx
incq %rdx
movq %r12, %rsi
callq 0x2200
movzbl (%r12), %eax
leaq (%rax,%r13), %rcx
leaq (%rax,%r13), %r12
addq $0x6, %r12
leaq (%rcx,%rbp), %rdi
addq $0x6, %rdi
movzbl (%r14), %edx
incq %rdx
movq %r14, %rsi
callq 0x2200
movzbl (%r14), %eax
addl %r12d, %eax
incl %eax
cmpl %ebx, %eax
jne 0x5b56
movq (%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x7229
testl %eax, %eax
je 0x5b45
leaq 0xb95a(%rip), %rdi      # 0x11490
movq %r15, %rsi
callq 0x69b1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5b47
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5ce1(%rip), %rdi      # 0xb83e
leaq 0x5ceb(%rip), %rsi      # 0xb84f
leaq 0x5d98(%rip), %rcx      # 0xb903
movl $0x214, %edx            # imm = 0x214
callq 0x2180