// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_server.c
// Function: proto_kvlds_response_range
int
proto_kvlds_response_range(struct netbuf_write * Q, uint64_t ID,
    size_t nkeys, const struct kvldskey * next,
    struct kvldskey ** keys, struct kvldskey ** values)
{
	uint8_t * wbuf;
	size_t len;
	size_t i;
	size_t bufpos;

	/* Sanity check: We can't return more than 2^32-1 keys. */
	assert(nkeys <= UINT32_MAX);

	/* Figure out how long the packet will be. */
	len = 8;
	len += kvldskey_serial_size(next);
	for (i = 0; i < nkeys; i++) {
		len += kvldskey_serial_size(keys[i]);
		len += kvldskey_serial_size(values[i]);
	}

	/* Get a packet data buffer. */
	if ((wbuf = wire_writepacket_getbuf(Q, ID, len)) == NULL)
		goto err0;

	/* Write the packet data. */
	be32enc(&wbuf[0], 0);
	be32enc(&wbuf[4], (uint32_t)nkeys);
	bufpos = 8;
	kvldskey_serialize(next, &wbuf[bufpos]);
	bufpos += kvldskey_serial_size(next);
	for (i = 0; i < nkeys; i++) {
		kvldskey_serialize(keys[i], &wbuf[bufpos]);
		bufpos += kvldskey_serial_size(keys[i]);
		kvldskey_serialize(values[i], &wbuf[bufpos]);
		bufpos += kvldskey_serial_size(values[i]);
	}

	/* Finish the packet. */
	if (wire_writepacket_done(Q, wbuf, len))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rax
shrq $0x20, %rax
jne 0x10f98
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r13
movq %rdi, %r15
movzbl (%rcx), %r12d
addq $0x9, %r12
testq %rdx, %rdx
je 0x10ea6
xorl %eax, %eax
movq %rdx, %rdi
movq (%r14,%rax,8), %rcx
movzbl (%rcx), %ecx
movq (%rbx,%rax,8), %rdx
movzbl (%rdx), %edx
addq %r12, %rcx
leaq (%rdx,%rcx), %r12
addq $0x2, %r12
incq %rax
cmpq %rax, %rdi
jne 0x10e83
jmp 0x10ea9
movq %rdx, %rdi
movq %rdi, (%rsp)
movq %r15, %rdi
movq %r12, %rdx
callq 0x125e0
testq %rax, %rax
je 0x10f80
movq %rax, %rbp
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl $0x0, (%rax)
movq (%rsp), %rcx
movb %cl, 0x7(%rax)
movb %ch, 0x6(%rax)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x5(%rbp)
movl %ecx, %eax
movq %rcx, %r15
shrl $0x18, %eax
movb %al, 0x4(%rbp)
leaq 0x8(%rbp), %rdi
movzbl (%r13), %edx
incq %rdx
movq %r13, %rsi
callq 0x2280
testq %r15, %r15
je 0x10f6a
movq %rbx, %r12
movzbl (%r13), %r15d
addq $0x9, %r15
xorl %r13d, %r13d
leaq (%r15,%rbp), %rdi
movq (%r14,%r13,8), %rsi
movzbl (%rsi), %edx
incq %rdx
callq 0x2280
movq (%r14,%r13,8), %rax
movq %rbp, %rbx
movzbl (%rax), %ebp
addq %r15, %rbp
leaq (%rbx,%rbp), %rdi
incq %rdi
movq (%r12,%r13,8), %rsi
movzbl (%rsi), %edx
incq %rdx
callq 0x2280
movq (%r12,%r13,8), %rax
movzbl (%rax), %eax
leaq (%rax,%rbp), %r15
addq $0x2, %r15
movq %rbx, %rbp
incq %r13
cmpq %r13, (%rsp)
jne 0x10f19
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
callq 0x126ae
testl %eax, %eax
je 0x10f87
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x10f89
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x595a(%rip), %rdi      # 0x168f9
leaq 0x5889(%rip), %rsi      # 0x1682f
leaq 0x5960(%rip), %rcx      # 0x1690d
movl $0x13d, %edx            # imm = 0x13D
callq 0x21c0