// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/lzf_d.c
// Function: lzf_decompress
unsigned int 
lzf_decompress (const void *const in_data,  unsigned int in_len,
                void             *out_data, unsigned int out_len)
{
  u8 const *ip = (const u8 *)in_data;
  u8       *op = (u8 *)out_data;
  u8 const *const in_end  = ip + in_len;
  u8       *const out_end = op + out_len;

  do
    {
      unsigned int ctrl = *ip++;

      if (ctrl < (1 << 5)) /* literal run */
        {
          ctrl++;

          if (op + ctrl > out_end)
            {
              SET_ERRNO (E2BIG);
              return 0;
            }

#if CHECK_INPUT
          if (ip + ctrl > in_end)
            {
              SET_ERRNO (EINVAL);
              return 0;
            }
#endif

#ifdef lzf_movsb
          lzf_movsb (op, ip, ctrl);
#else
          do
            *op++ = *ip++;
          while (--ctrl);
#endif
        }
      else /* back reference */
        {
          unsigned int len = ctrl >> 5;

          u8 *ref = op - ((ctrl & 0x1f) << 8) - 1;

#if CHECK_INPUT
          if (ip >= in_end)
            {
              SET_ERRNO (EINVAL);
              return 0;
            }
#endif
          if (len == 7)
            {
              len += *ip++;
#if CHECK_INPUT
              if (ip >= in_end)
                {
                  SET_ERRNO (EINVAL);
                  return 0;
                }
#endif
            }

          ref -= *ip++;

          if (op + len + 2 > out_end)
            {
              SET_ERRNO (E2BIG);
              return 0;
            }

          if (ref < (u8 *)out_data)
            {
              SET_ERRNO (EINVAL);
              return 0;
            }

#ifdef lzf_movsb
          len += 2;
          lzf_movsb (op, ref, len);
#else
          *op++ = *ref++;
          *op++ = *ref++;

          do
            *op++ = *ref++;
          while (--len);
#endif
        }
    }
  while (ip < in_end);

  return op - (u8 *)out_data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl -0x14(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl -0x24(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movzbl (%rax), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x20, -0x4c(%rbp)
jae 0x2f4af
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movl -0x4c(%rbp), %ecx
addq %rcx, %rax
cmpq -0x48(%rbp), %rax
jbe 0x2f451
callq 0x1f820
movl $0x7, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2f640
movq -0x30(%rbp), %rax
movl -0x4c(%rbp), %ecx
addq %rcx, %rax
cmpq -0x40(%rbp), %rax
jbe 0x2f478
callq 0x1f820
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2f640
jmp 0x2f47a
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, %eax
jne 0x2f47a
jmp 0x2f622
movl -0x4c(%rbp), %eax
shrl $0x5, %eax
movl %eax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movl -0x4c(%rbp), %ecx
andl $0x1f, %ecx
shll $0x8, %ecx
movl %ecx, %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x2f4fa
callq 0x1f820
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2f640
cmpl $0x7, -0x50(%rbp)
jne 0x2f53b
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movzbl (%rax), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x2f539
callq 0x1f820
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2f640
jmp 0x2f53b
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movzbl (%rax), %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl -0x50(%rbp), %ecx
addq %rcx, %rax
addq $0x2, %rax
cmpq -0x48(%rbp), %rax
jbe 0x2f58b
callq 0x1f820
movl $0x7, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2f640
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x2f5ac
callq 0x1f820
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2f640
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
movb (%rax), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
movb (%rax), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
movb (%rax), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
movl -0x50(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, %eax
jne 0x2f5f0
jmp 0x2f622
jmp 0x2f624
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x2f402
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)