// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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
          switch (ctrl)
            {
              case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++;
              case 28: *op++ = *ip++; case 27: *op++ = *ip++; case 26: *op++ = *ip++; case 25: *op++ = *ip++;
              case 24: *op++ = *ip++; case 23: *op++ = *ip++; case 22: *op++ = *ip++; case 21: *op++ = *ip++;
              case 20: *op++ = *ip++; case 19: *op++ = *ip++; case 18: *op++ = *ip++; case 17: *op++ = *ip++;
              case 16: *op++ = *ip++; case 15: *op++ = *ip++; case 14: *op++ = *ip++; case 13: *op++ = *ip++;
              case 12: *op++ = *ip++; case 11: *op++ = *ip++; case 10: *op++ = *ip++; case  9: *op++ = *ip++;
              case  8: *op++ = *ip++; case  7: *op++ = *ip++; case  6: *op++ = *ip++; case  5: *op++ = *ip++;
              case  4: *op++ = *ip++; case  3: *op++ = *ip++; case  2: *op++ = *ip++; case  1: *op++ = *ip++;
            }
#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
          switch (len)
            {
              default:
                len += 2;

                if (op >= ref + len)
                  {
                    /* disjunct areas */
                    memcpy (op, ref, len);
                    op += len;
                  }
                else
                  {
                    /* overlapping, use octte by octte copying */
                    do
                      *op++ = *ref++;
                    while (--len);
                  }

                break;

              case 9: *op++ = *ref++;
              case 8: *op++ = *ref++;
              case 7: *op++ = *ref++;
              case 6: *op++ = *ref++;
              case 5: *op++ = *ref++;
              case 4: *op++ = *ref++;
              case 3: *op++ = *ref++;
              case 2: *op++ = *ref++;
              case 1: *op++ = *ref++;
              case 0: *op++ = *ref++; /* two octets more */
                      *op++ = *ref++;
            }
#endif
        }
    }
  while (ip < in_end);

  return op - (u8 *)out_data;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r13
movl %esi, %r12d
addq %rdi, %r12
movl %ecx, %r10d
addq %rdx, %r10
leaq 0x7e6ff(%rip), %r8      # 0xb1730
leaq 0x7e6d4(%rip), %r14     # 0xb170c
movq %rdx, %rbx
leaq 0x1(%rdi), %rbp
movzbl (%rdi), %eax
cmpl $0x1f, %eax
ja 0x331df
leaq (%rbx,%rax), %rcx
incq %rcx
cmpq %r10, %rcx
ja 0x33313
leaq 0x1(%rax), %rcx
addq %rbp, %rcx
cmpq %r12, %rcx
ja 0x33306
movl %eax, %eax
movslq (%r8,%rax,4), %rax
addq %r8, %rax
jmpq *%rax
movb 0x1(%rdi), %al
addq $0x2, %rdi
movb %al, (%rbx)
incq %rbx
movq %rdi, %rbp
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
movb (%rbp), %al
incq %rbp
movb %al, (%rbx)
incq %rbx
jmp 0x332b1
cmpq %r12, %rbp
jae 0x33306
movl %eax, %ecx
shrl $0x5, %ecx
cmpl $0x7, %ecx
jne 0x33206
leaq 0x2(%rdi), %rbp
cmpq %r12, %rbp
jae 0x33306
movzbl 0x1(%rdi), %ecx
addl $0x7, %ecx
movl %ecx, %r15d
leaq (%rbx,%r15), %rdx
addq $0x2, %rdx
cmpq %r10, %rdx
ja 0x33313
andl $0x1f, %eax
shll $0x8, %eax
movq %rax, %rsi
notq %rsi
addq %rbx, %rsi
movzbl (%rbp), %edx
subq %rdx, %rsi
cmpq %r13, %rsi
jb 0x33306
incq %rbp
leal -0x1(%rcx), %edi
cmpl $0x8, %edi
ja 0x332bf
movslq (%r14,%rdi,4), %rax
addq %r14, %rax
jmpq *%rax
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
incq %rsi
movb %al, (%rbx)
incq %rbx
movb (%rsi), %al
movb %al, (%rbx)
movb 0x1(%rsi), %al
movb %al, 0x1(%rbx)
movb 0x2(%rsi), %al
movb %al, 0x2(%rbx)
addq $0x3, %rbx
movq %rbp, %rdi
cmpq %r12, %rbp
jb 0x3303b
jmp 0x33322
leaq (%rsi,%r15), %rdi
addq $0x2, %rdi
cmpq %rdi, %rbx
jae 0x332e3
addl $0x2, %ecx
addq %rax, %rdx
notq %rdx
movb (%rbx,%rdx), %al
movb %al, (%rbx)
incq %rbx
decl %ecx
jne 0x332d5
jmp 0x332b1
addq $0x2, %r15
movq %rbx, %rdi
movq %r15, %rdx
movq %r10, (%rsp)
callq 0x26c50
movq (%rsp), %r10
leaq 0x7e42f(%rip), %r8      # 0xb1730
addq %r15, %rbx
jmp 0x332b1
callq 0x26880
movl $0x16, (%rax)
jmp 0x3331e
callq 0x26880
movl $0x7, (%rax)
xorl %ebx, %ebx
jmp 0x33325
subl %r13d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop