// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_dynamodb_kv/proto_dynamodb_kv_server.c
// Function: proto_dynamodb_kv_request_read
int
proto_dynamodb_kv_request_read(struct netbuf_read * R,
    struct proto_ddbkv_request * req)
{
	struct wire_packet P;

	/* Try to grab a packet from the buffered reader. */
	if (wire_readpacket_peek(R, &P))
		goto err0;

	/* Do we have a packet? */
	if (P.buf == NULL)
		goto nopacket;

	/* Parse this packet. */
	if (proto_dynamodb_kv_request_parse(&P, req))
		goto err0;

	/* Consume the packet. */
	wire_readpacket_consume(R, &P);

	/* Success! */
	return (0);

nopacket:
	/* Record that no request was available. */
	req->type = PROTO_DDBKV_NONE;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x20(%rsp), %rsi
callq 0xe818
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0xdbac
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %r12
testq %r12, %r12
je 0xdca0
movq 0x20(%rsp), %rax
movq %rax, (%r14)
xorl %eax, %eax
movq %rax, 0x10(%r14)
movq %rax, 0x20(%r14)
movq %rax, 0x30(%r14)
movq 0x28(%rsp), %rcx
cmpq $0x4, %rcx
jb 0xdb9b
movl (%r12), %esi
bswapl %esi
movl %esi, 0x8(%r14)
je 0xdb9b
movzbl 0x4(%r12), %r13d
leaq 0x5(%r13), %rdx
cmpq %rdx, %rcx
jb 0xdb9b
leaq 0x5(%r12), %rbp
testq %r13, %r13
je 0xdc11
xorl %eax, %eax
cmpb $0x0, (%rbp,%rax)
je 0xdb9b
incq %rax
cmpq %rax, %r13
jne 0xdc02
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
leaq 0x1(%r13), %rdi
callq 0x34d0
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0xdb9b
movq %rax, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %rax, %rbp
callq 0x3290
movb $0x0, (%rbp,%r13)
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
addl $0xfffeff00, %eax       # imm = 0xFFFEFF00
cmpl $0x20, %eax
ja 0xdd6c
movl $0x7, %ecx
btq %rax, %rcx
jb 0xdcaf
movabsq $0x100030000, %rcx      # imm = 0x100030000
btq %rax, %rcx
movq 0x8(%rsp), %rax
jae 0xdd6c
cmpq %rax, 0x18(%rsp)
jne 0xdd6c
leaq 0x20(%rsp), %rsi
movq %r15, %rdi
callq 0xecd5
jmp 0xdca8
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
xorl %ebx, %ebx
jmp 0xdb9b
addq $0x9, %r13
movq 0x18(%rsp), %rax
cmpq %r13, %rax
movq 0x8(%rsp), %rcx
jb 0xdd6a
movl (%r12,%rcx), %ebp
bswapl %ebp
movl %ebp, 0x18(%r14)
movq %r13, %rcx
addq %rbp, %rcx
cmpq %rcx, %rax
jb 0xdd6a
movq %rcx, 0x8(%rsp)
movq %rbp, %rdi
callq 0x34d0
movq %rax, 0x20(%r14)
testq %rax, %rax
je 0xdd6a
addq %r12, %r13
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3290
cmpl $0x10101, 0x10(%rsp)    # imm = 0x10101
jne 0xdd8b
movq 0x8(%rsp), %rcx
leaq 0x4(%rcx), %rdx
movq 0x18(%rsp), %rax
cmpq %rdx, %rax
jb 0xdd6a
movl (%r12,%rcx), %r13d
bswapl %r13d
movl %r13d, 0x28(%r14)
movq %rdx, 0x10(%rsp)
leaq (%rdx,%r13), %rcx
movq %rcx, 0x8(%rsp)
cmpq %rcx, %rax
jb 0xdd6a
movq %r13, %rdi
callq 0x34d0
movq %rax, 0x30(%r14)
testq %rax, %rax
je 0xdd6a
movq %rax, %rbp
addq 0x10(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3290
jmp 0xdd8d
xorl %ebp, %ebp
movq %rbp, %rdi
callq 0x3460
movq 0x20(%r14), %rdi
callq 0x3460
movq 0x10(%r14), %rdi
callq 0x3460
jmp 0xdb9b
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
jmp 0xdc86