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

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

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

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

	/* Construct request. */
	be32enc(&buf[0], PROTO_KVLDS_SET);
	bufpos = 4;
	kvldskey_serialize(key, &buf[bufpos]);
	bufpos += kvldskey_serial_size(key);
	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_done_free(C);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
callq 0x7800
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x76a0
jmp 0x77e8
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
leaq 0x8270(%rip), %rcx      # 0xf932
movq %rcx, 0x10(%rax)
movq $0x4, -0x48(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
addq $0x1, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
addq $0x1, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rcx
leaq 0x119(%rip), %rdx       # 0x7820
callq 0x9630
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x771b
jmp 0x77df
movq -0x40(%rbp), %rdi
movl $0x110, %esi            # imm = 0x110
callq 0x7600
movq $0x4, -0x50(%rbp)
movq -0x40(%rbp), %rdi
addq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rdx
callq 0x2210
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
addq $0x1, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
addq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rdx
callq 0x2210
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
addq $0x1, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x779f
jmp 0x77be
leaq 0x8190(%rip), %rdi      # 0xf936
leaq 0x819a(%rip), %rsi      # 0xf947
movl $0x1d4, %edx            # imm = 0x1D4
leaq 0x81b6(%rip), %rcx      # 0xf96f
callq 0x21a0
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x97c0
cmpl $0x0, %eax
je 0x77d6
jmp 0x77df
movl $0x0, -0x4(%rbp)
jmp 0x77ef
movq -0x38(%rbp), %rdi
callq 0x78f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)