// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_server.c
// Function: proto_kvlds_request_read
int
proto_kvlds_request_read(struct netbuf_read * R,
    struct proto_kvlds_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_kvlds_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_KVLDS_NONE;

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x8(%rsp), %rsi
callq 0x11908
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x10956
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x10a3f
movq 0x8(%rsp), %rax
movq %rax, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movq $0x0, 0x20(%r14)
movq 0x10(%rsp), %r12
leaq -0x305(%r12), %rax
cmpq $-0x301, %rax           # imm = 0xFCFF
jb 0x10946
leaq 0x28(%r14), %r13
movq %r13, %rdi
movq %r12, %rdx
callq 0x2280
movl 0x28(%r14), %esi
bswapl %esi
movl %esi, 0x8(%r14)
cmpl $0x11f, %esi            # imm = 0x11F
jg 0x10a4e
cmpl $0x111, %esi            # imm = 0x111
jg 0x10ac8
cmpl $0x100, %esi            # imm = 0x100
je 0x10b5f
cmpl $0x110, %esi            # imm = 0x110
je 0x10ad7
cmpl $0x111, %esi            # imm = 0x111
jne 0x10b7b
cmpq $0x4, %r12
je 0x10b94
leaq 0x2c(%r14), %rax
movq %rax, 0x10(%r14)
movzbl 0x2c(%r14), %eax
leaq 0x5(%rax), %rcx
cmpq %r12, %rcx
jae 0x10b94
addq %r13, %rcx
movq %rcx, 0x20(%r14)
movzbl 0x2d(%r14,%rax), %ecx
addq %rcx, %rax
addq $0x6, %rax
cmpq %r12, %rax
jae 0x10b94
addq %rax, %r13
movq %r13, 0x18(%r14)
movzbl 0x28(%r14,%rax), %ecx
addq %rcx, %rax
incq %rax
jmp 0x10b0f
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
xorl %ebx, %ebx
jmp 0x10946
cmpl $0x12f, %esi            # imm = 0x12F
jg 0x10a97
cmpl $0x120, %esi            # imm = 0x120
je 0x10aab
cmpl $0x121, %esi            # imm = 0x121
jne 0x10b7b
cmpq $0x4, %r12
je 0x10b94
leaq 0x2c(%r14), %rax
movq %rax, 0x10(%r14)
movzbl 0x2c(%r14), %eax
leaq 0x5(%rax), %rcx
cmpq %r12, %rcx
jae 0x10b94
addq %rcx, %r13
movq %r13, 0x20(%r14)
jmp 0x10b02
cmpl $0x131, %esi            # imm = 0x131
je 0x10b16
cmpl $0x130, %esi            # imm = 0x130
jne 0x10b7b
cmpq $0x4, %r12
je 0x10b94
leaq 0x2c(%r14), %rax
movq %rax, 0x10(%r14)
movzbl 0x2c(%r14), %eax
addq $0x5, %rax
jmp 0x10b0f
leal -0x112(%rsi), %eax
cmpl $0x2, %eax
jae 0x10b7b
cmpq $0x4, %r12
je 0x10b94
leaq 0x2c(%r14), %rax
movq %rax, 0x10(%r14)
movzbl 0x2c(%r14), %eax
leaq 0x5(%rax), %rcx
cmpq %r12, %rcx
jae 0x10b94
addq %rcx, %r13
movq %r13, 0x18(%r14)
movzbl 0x2d(%r14,%rax), %ecx
addq %rcx, %rax
addq $0x6, %rax
cmpq %r12, %rax
jbe 0x10b64
jmp 0x10b94
movl %r12d, %eax
andl $0x3fc, %eax            # imm = 0x3FC
cmpl $0x4, %eax
je 0x10b89
movl 0x2c(%r14), %eax
bswapl %eax
movl %eax, 0xc(%r14)
cmpq $0x8, %r12
je 0x10b94
leaq 0x30(%r14), %rax
movq %rax, 0x10(%r14)
movzbl 0x30(%r14), %eax
leaq 0x9(%rax), %rcx
cmpq %r12, %rcx
jae 0x10b94
addq %rcx, %r13
movq %r13, 0x18(%r14)
movzbl 0x31(%r14,%rax), %ecx
addq %rcx, %rax
addq $0xa, %rax
jmp 0x10b0f
movl $0x4, %eax
cmpq %r12, %rax
jne 0x10b94
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x11db0
jmp 0x10a47
leaq 0x5e14(%rip), %rdi      # 0x16996
xorl %eax, %eax
callq 0x10167
callq 0x20a0
movl $0x0, (%rax)
callq 0x20a0
cmpl $0x0, (%rax)
movl 0x8(%r14), %esi
je 0x10bbf
movq %rax, %r15
leaq 0x5e15(%rip), %rdi      # 0x169c1
xorl %eax, %eax
callq 0x10048
movl $0x0, (%r15)
jmp 0x10946
leaq 0x5dfb(%rip), %rdi      # 0x169c1
xorl %eax, %eax
callq 0x10167
jmp 0x10946