// File: /workspace/github_c_makefile_star2_O2/pali[P]bmfdec/./bmfdec.c
// Function: dblb_decrep
INLINE int dblb_decrep(bits_t *pbits, __u8 **p, void *pout, __u8 *pend,
		 int repoffs, int k, int flg)
{ int replen;
  __u8 *r;

  if(repoffs==0){LOG_DECOMP("DMSDOS: decrb: zero offset ?\n");return -2;}
  if(repoffs==0x113f)
  { 
    int pos=*p-(__u8*)pout;
    LOG_DECOMP("DMSDOS: decrb: 0x113f sync found.\n");
    if((pos%512) && !(flg&0x4000))
    { LOG_DECOMP("DMSDOS: decrb: sync at decompressed pos %d ?\n",pos);
      return -2;
    }
    return 0;
  }
  replen=dblb_rdlen(pbits)+k;

  if(replen<=0)
    {LOG_DECOMP("DMSDOS: decrb: illegal count ?\n");return -2;}
  if((__u8*)pout+repoffs>*p)
    {LOG_DECOMP("DMSDOS: decrb: of>pos ?\n");return -2;}
  if(*p+replen>pend)
    {LOG_DECOMP("DMSDOS: decrb: output overfill ?\n");return -2;}
  r=*p-repoffs;
  M_MOVSB(*p,r,replen);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq $-0x2
popq %rbx
testl %r8d, %r8d
je 0x14f3
movl %r8d, %ebp
movq %rdx, %r12
movq %rsi, %r14
cmpl $0x113f, %r8d           # imm = 0x113F
jne 0x14fe
movl (%r14), %eax
subl %r12d, %eax
xorl %ecx, %ecx
testw $0x1ff, %ax             # imm = 0x1FF
sete %cl
xorl %eax, %eax
btl $0xe, %r9d
leal -0x2(%rcx,%rcx), %ebx
cmovbl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %r15
movl (%rdi), %eax
movl 0x4(%rdi), %ecx
cmpl $0x10, %ecx
jl 0x152f
shrl $0x10, %eax
movl %eax, (%rdi)
addl $-0x10, %ecx
movq 0x8(%rdi), %rdx
cmpq 0x10(%rdi), %rdx
jae 0x152f
leaq 0x2(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzwl (%rdx), %edx
shll $0x10, %edx
orl %edx, %eax
movl %eax, (%rdi)
shrl %cl, %eax
movl %eax, %edx
andl $0xf, %edx
leaq 0x4ae3(%rip), %rsi      # 0x6020
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
incl %ecx
movl %ecx, 0x4(%rdi)
pushq $0x3
popq %rax
jmp 0x15e2
addl $0x3, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x2, %eax
andl $0x1, %eax
orl $0x4, %eax
jmp 0x15e2
addl $0x5, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x3, %eax
andl $0x3, %eax
addl $0x6, %eax
jmp 0x15e2
addl $0x7, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x4, %eax
andl $0x7, %eax
addl $0xa, %eax
jmp 0x15e2
movl %eax, %edx
shrl $0x4, %edx
andl $0xf, %edx
leaq 0x4acb(%rip), %rsi      # 0x6060
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
addl $0x9, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x5, %eax
andl $0xf, %eax
addl $0x12, %eax
jmp 0x15e2
addl $0xb, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x6, %eax
andl $0x1f, %eax
addl $0x22, %eax
jmp 0x15e2
addl $0xd, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x7, %eax
andl $0x3f, %eax
addl $0x42, %eax
jmp 0x15e2
addl $0xf, %ecx
movl %ecx, 0x4(%rdi)
shrl $0x8, %eax
andl $0x7f, %eax
addl $0x82, %eax
decl %eax
movl %ebp, %edx
addq %rdx, %r12
movq (%r14), %rcx
cmpq %rcx, %r12
ja 0x14f3
movl %eax, %eax
leaq (%rcx,%rax), %rsi
cmpq %r15, %rsi
ja 0x14f3
subq %rdx, %rcx
xorl %ebx, %ebx
xorl %edx, %edx
cmpl %edx, %eax
je 0x14f3
movb (%rcx,%rdx), %sil
movq (%r14), %rdi
leaq 0x1(%rdi), %r8
movq %r8, (%r14)
movb %sil, (%rdi)
incq %rdx
jmp 0x160b
addl $0x9, %ecx
movl %ecx, 0x4(%rdi)
btl $0x8, %eax
jae 0x14f3
pushq $0x8
popq %rsi
callq 0x1472
leal 0x102(%rax), %ecx
cmpl $0x2, %ecx
jl 0x14f3
addl $0x101, %eax            # imm = 0x101
jmp 0x15e4