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

	/* The request size must fit into a uint32_t. */
	if (max >= UINT32_MAX)
		max = UINT32_MAX;

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct range_cookie))) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;
	C->max = max;

	/* Compute request size. */
	buflen = 8;
	buflen += kvldskey_serial_size(start);
	buflen += kvldskey_serial_size(end);

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

	/* Construct request. */
	be32enc(&buf[0], PROTO_KVLDS_RANGE);
	be32enc(&buf[4], (uint32_t)max);
	bufpos = 8;
	kvldskey_serialize(start, &buf[bufpos]);
	bufpos += kvldskey_serial_size(start);
	kvldskey_serialize(end, &buf[bufpos]);
	bufpos += kvldskey_serial_size(end);

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

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

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x28(%rbp)
jb 0x8504
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x28(%rbp)
movl $0x18, %edi
callq 0x2230
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x851d
jmp 0x8675
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq $0x8, -0x50(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
addq $0x1, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
addq $0x1, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rcx
leaq 0x10f(%rip), %rdx       # 0x8690
callq 0x9630
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jne 0x8595
jmp 0x866c
movq -0x48(%rbp), %rdi
movl $0x131, %esi            # imm = 0x131
callq 0x7600
movq -0x48(%rbp), %rdi
addq $0x4, %rdi
movq -0x28(%rbp), %rax
movl %eax, %esi
callq 0x7600
movq $0x8, -0x58(%rbp)
movq -0x48(%rbp), %rdi
addq -0x58(%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 -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
addq -0x58(%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 -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x862c
jmp 0x864b
leaq 0x7303(%rip), %rdi      # 0xf936
leaq 0x730d(%rip), %rsi      # 0xf947
movl $0x375, %edx            # imm = 0x375
leaq 0x761b(%rip), %rcx      # 0xfc61
callq 0x21a0
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x97c0
cmpl $0x0, %eax
je 0x8663
jmp 0x866c
movl $0x0, -0x4(%rbp)
jmp 0x867c
movq -0x40(%rbp), %rdi
callq 0x2040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)