// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_client.c
// Function: callback_range
static int
callback_range(void * cookie, uint8_t * buf, size_t buflen)
{
	struct range_cookie * C = cookie;
	int failed = 1;
	size_t bufpos = 0;
	size_t nkeys = 0;
	struct kvldskey * next = NULL;
	struct kvldskey ** keys = NULL;
	struct kvldskey ** values = NULL;
	size_t klen;
	size_t i;
	int rc;

	/* If we have a packet, parse it. */
	if (buf != NULL) {
		/* Is the status code sane? */
		if (buflen - bufpos < 4)
			BAD("RANGE", "bogus length");
		if (be32dec(&buf[bufpos]) != 0)
			BAD("RANGE", "bogus status code");
		bufpos += 4;

		/* Parse and sanity-check the number of key-value pairs. */
		if (buflen - bufpos < 4)
			BAD("RANGE", "bogus length");
		nkeys = be32dec(&buf[bufpos]);
		if ((nkeys > 1) && (nkeys > C->max / 2))
			BAD("RANGE", "too many key-value pairs");
		bufpos += 4;

		/* Parse next key. */
		if ((klen = kvldskey_unserialize(&next, &buf[bufpos],
		    buflen - bufpos)) == 0) {
			warnp("Error parsing RANGE response next key");
			goto failed;
		}
		bufpos += klen;

		/* Allocate buffer for keys. */
		if (IMALLOC(keys, nkeys, struct kvldskey *))
			goto failed;
		for (i = 0; i < nkeys; i++)
			keys[i] = NULL;

		/* Allocate buffer for values. */
		if (IMALLOC(values, nkeys, struct kvldskey *))
			goto failed;
		for (i = 0; i < nkeys; i++)
			values[i] = NULL;

		/* Parse keys and values. */
		for (i = 0; i < nkeys; i++) {
			if ((klen = kvldskey_unserialize(&keys[i],
			    &buf[bufpos], buflen - bufpos)) == 0) {
				warnp("Error parsing RANGE response key");
				goto failed;
			}
			bufpos += klen;

			if ((klen = kvldskey_unserialize(&values[i],
			    &buf[bufpos], buflen - bufpos)) == 0) {
				warnp("Error parsing RANGE response value");
				goto failed;
			}
			bufpos += klen;
		}

		/* Make sure we reached the end of the packet. */
		if (buflen != bufpos)
			BAD("RANGE", "wrong length");

		/* We successfully parsed this response. */
		failed = 0;
	}

failed:
	/* If we failed, clean up. */
	if (failed) {
		if (values) {
			for (i = 0; i < nkeys; i++)
				kvldskey_free(values[i]);
			free(values);
			values = NULL;
		}
		if (keys) {
			for (i = 0; i < nkeys; i++)
				kvldskey_free(keys[i]);
			free(keys);
			keys = NULL;
		}
		nkeys = 0;
		kvldskey_free(next);
		next = NULL;
	}

	/* Invoke the upstream callback. */
	rc = (C->callback)(C->cookie, failed, nkeys, next, keys, values);

	/* Free the cookie. */
	free(C);

	/* Return status from callback. */
	return (rc);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x8a7b
movq -0x18(%rbp), %rax
subq -0x30(%rbp), %rax
cmpq $0x4, %rax
jae 0x8724
jmp 0x86f6
jmp 0x86f8
leaq 0x7637(%rip), %rdi      # 0xfd36
leaq 0x76a5(%rip), %rsi      # 0xfdab
leaq 0x764d(%rip), %rdx      # 0xfd5a
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8a7d
movq -0x10(%rbp), %rdi
addq -0x30(%rbp), %rdi
callq 0x8dc0
cmpl $0x0, %eax
je 0x8766
jmp 0x8738
jmp 0x873a
leaq 0x75f5(%rip), %rdi      # 0xfd36
leaq 0x7663(%rip), %rsi      # 0xfdab
leaq 0x7618(%rip), %rdx      # 0xfd67
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8a7d
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
subq -0x30(%rbp), %rax
cmpq $0x4, %rax
jae 0x87b0
jmp 0x8782
jmp 0x8784
leaq 0x75ab(%rip), %rdi      # 0xfd36
leaq 0x7619(%rip), %rsi      # 0xfdab
leaq 0x75c1(%rip), %rdx      # 0xfd5a
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8a7d
movq -0x10(%rbp), %rdi
addq -0x30(%rbp), %rdi
callq 0x8dc0
movl %eax, %eax
movq %rax, -0x38(%rbp)
cmpq $0x1, -0x38(%rbp)
jbe 0x880e
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
shrq %rcx
cmpq %rcx, %rax
jbe 0x880e
jmp 0x87e0
jmp 0x87e2
leaq 0x754d(%rip), %rdi      # 0xfd36
leaq 0x75bb(%rip), %rsi      # 0xfdab
leaq 0x75ba(%rip), %rdx      # 0xfdb1
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8a7d
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq -0x30(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x72c0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
jne 0x8879
jmp 0x883f
callq 0x20a0
cmpl $0x0, (%rax)
je 0x8864
leaq 0x757a(%rip), %rdi      # 0xfdca
movb $0x0, %al
callq 0x67c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8872
leaq 0x755f(%rip), %rdi      # 0xfdca
movb $0x0, %al
callq 0x6a10
jmp 0x8874
jmp 0x8a7d
movq -0x58(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movl $0x8, %esi
callq 0x90d0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jne 0x88a9
cmpq $0x0, -0x38(%rbp)
jbe 0x88a9
jmp 0x8a7d
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x88d9
movq -0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x88b1
movq -0x38(%rbp), %rdi
movl $0x8, %esi
callq 0x90d0
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jne 0x88fd
cmpq $0x0, -0x38(%rbp)
jbe 0x88fd
jmp 0x8a7d
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x892d
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x8905
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x8a3d
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq -0x30(%rbp), %rdx
callq 0x72c0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
jne 0x89ad
jmp 0x8973
callq 0x20a0
cmpl $0x0, (%rax)
je 0x8998
leaq 0x746c(%rip), %rdi      # 0xfdf0
movb $0x0, %al
callq 0x67c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x89a6
leaq 0x7451(%rip), %rdi      # 0xfdf0
movb $0x0, %al
callq 0x6a10
jmp 0x89a8
jmp 0x8a7d
movq -0x58(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq -0x30(%rbp), %rdx
callq 0x72c0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
jne 0x8a20
jmp 0x89e9
callq 0x20a0
cmpl $0x0, (%rax)
je 0x8a0e
leaq 0x7417(%rip), %rdi      # 0xfe11
movb $0x0, %al
callq 0x67c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8a1c
leaq 0x73fc(%rip), %rdi      # 0xfe11
movb $0x0, %al
callq 0x6a10
jmp 0x8a1e
jmp 0x8a7d
movq -0x58(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x8935
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0x8a74
jmp 0x8a49
jmp 0x8a4b
leaq 0x72e4(%rip), %rdi      # 0xfd36
leaq 0x7352(%rip), %rsi      # 0xfdab
leaq 0x733e(%rip), %rdx      # 0xfd9e
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x8a7d
movl $0x0, -0x24(%rbp)
jmp 0x8a7d
cmpl $0x0, -0x24(%rbp)
je 0x8b32
cmpq $0x0, -0x50(%rbp)
je 0x8ad0
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x8abf
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x8a96
movq -0x50(%rbp), %rdi
callq 0x2040
movq $0x0, -0x50(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x8b19
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x8b08
movq -0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x8adf
movq -0x48(%rbp), %rdi
callq 0x2040
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2040
movq $0x0, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rdi
movl -0x24(%rbp), %esi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %r9
callq *%rax
movl %eax, -0x64(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2040
movl -0x64(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)