// File: /workspace/github_c_makefile_star2_O3/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 0xba9d(%rip)            # 0x114a8
movq %rsi, %r13
movq 0xba7b(%rip), %rax      # 0x11490
testq %rax, %rax
movq %rdi, (%rsp)
je 0x5a37
movq 0xba7b(%rip), %rcx      # 0x114a0
leaq -0x1(%rax), %rdx
movq %rdx, 0xba60(%rip)      # 0x11490
movq -0x8(%rcx,%rax,8), %r15
jmp 0x5a6e
incq 0xba72(%rip)            # 0x114b0
cmpl $0x0, 0xba73(%rip)      # 0x114b8
jne 0x5a5d
movq 0xba7a(%rip), %rdi      # 0x114c8
callq 0xa0d0
movl $0x1, 0xba5b(%rip)      # 0x114b8
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
movq (%rsp), %rdi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x5b5f
movq %rbp, (%r15)
movq %rbx, 0x8(%r15)
leaq 0x5e85(%rip), %rax      # 0xb90f
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        # 0x5b8d
movq %rbx, %rsi
movq %r15, %rcx
callq 0x6f66
testq %rax, %rax
je 0x5b47
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 0x5b6e
movq (%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x7261
testl %eax, %eax
je 0x5b5d
leaq 0xb942(%rip), %rdi      # 0x11490
movq %r15, %rsi
callq 0x69a9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5b5f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5cd9(%rip), %rdi      # 0xb84e
leaq 0x5ce3(%rip), %rsi      # 0xb85f
leaq 0x5d90(%rip), %rcx      # 0xb913
movl $0x214, %edx            # imm = 0x214
callq 0x2180