// File: /workspace/github_c_makefile_star2_O2/thegenemyers[P]DASCRUBBER/QV.c
// Function: Decode_Run
static int Decode_Run(HScheme *neme, HScheme *reme, FILE *in, char *read,
                      int rlen, int rchar)
{ int    *nlook, *nlens;
  int    *rlook, *rlens;
  int     nsignal, ilen;
  uint64  icode;
  uint32 *ipart;
  uint16 *xpart;
  uint8  *cpart;
  int     j, n, c, k;

  if (LittleEndian)
    { ipart = ((uint32 *) (&icode));
      xpart = ((uint16 *) (&icode)) + 2;
      cpart = ((uint8  *) (&icode)) + 5;
    }
  else
    { ipart = ((uint32 *) (&icode)) + 1;
      xpart = ((uint16 *) (&icode)) + 1;
      cpart = ((uint8  *) (&icode)) + 2;
    }

  if (neme->type == 2)
    nsignal = 255;
  else
    nsignal = 256;
  nlens = neme->codelens;
  nlook = neme->lookup;

  rlens = reme->codelens;
  rlook = reme->lookup;

  n     = 16;
  ilen  = 0;
  icode = 0;
  if (Flip)
    for (j = 0; j < rlen; j++)
      { GETFLIP
        c = rlook[*xpart];
        n = rlens[c];
        if (c == 255)
          { GETFLIP
            c = *xpart;
            n = 16;
          }
        for (k = 0; k < c; k++)
          read[j++] = (char) rchar;

        if (j < rlen)
          { GETFLIP
            c = nlook[*xpart];
            n = nlens[c];
            if (c == nsignal)
              { GETFLIP
                c = *cpart;
                n = 8;
              }
            read[j] = (char) c;
          }
      }
  else
    for (j = 0; j < rlen; j++)
      { GET
        c = rlook[*xpart];
        n = rlens[c];
        if (c == 255)
          { GET
            c = *xpart;
            n = 16;
          }
        for (k = 0; k < c; k++)
          read[j++] = (char) rchar;

        if (j < rlen)
          { GET
            c = nlook[*xpart];
            n = nlens[c];
            if (c == nsignal)
              { GET
                c = *cpart;
                n = 8;
              }
            read[j] = (char) c;
          }
      }

  return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebx
movl %r8d, 0xc(%rsp)
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, 0x40(%rsp)
movzbl 0xb170(%rip), %eax      # 0x139e4
leaq 0x4(%rsp), %rcx
testq %rax, %rax
movq %rsp, %rbp
cmoveq %rcx, %rbp
leaq 0x2(%rax,%rax), %rcx
movq %rcx, 0x18(%rsp)
leaq (%rax,%rax,2), %rax
addq $0x2, %rax
movq %rax, 0x30(%rsp)
xorl %eax, %eax
movq %rdi, 0x38(%rsp)
cmpl $0x2, (%rdi)
setne %al
addl $0xff, %eax
movl %eax, 0x24(%rsp)
cmpl $0x0, 0xb129(%rip)      # 0x139e0
je 0x8ad2
pushq $0x10
popq %rcx
movq $0x0, 0x28(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %r12d, %r12d
cmpl 0xc(%rsp), %r12d
jge 0x8ce7
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8927
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq %rbp, %rdi
callq 0x7983
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
jmp 0x892c
shlq %cl, %rdx
subl %ecx, %eax
movq 0x18(%rsp), %rcx
movzwl (%rsp,%rcx), %esi
movq 0x40(%rsp), %rcx
movslq 0x804(%rcx,%rsi,4), %r13
movl 0x404(%rcx,%r13,4), %ecx
cmpq $0xff, %r13
jne 0x89b8
movl %ecx, %r15d
subl %eax, %r15d
jle 0x89a8
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq %rbp, %rdi
callq 0x7983
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
movq 0x18(%rsp), %rcx
movzwl (%rsp,%rcx), %esi
jmp 0x89b1
shlq %cl, %rdx
movq %rdx, (%rsp)
subl %ecx, %eax
movzwl %si, %r13d
pushq $0x10
popq %rcx
movslq %r12d, %rdi
testl %r13d, %r13d
movl $0x0, %r9d
cmovlel %r9d, %r13d
addl %r12d, %r13d
movslq %r13d, %r12
cmpq %rdi, %r12
je 0x89dc
movb %bl, (%r14,%rdi)
incq %rdi
jmp 0x89ce
cmpl 0xc(%rsp), %r13d
jge 0x8ac7
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8a3c
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq %rbp, %rdi
callq 0x7983
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
movq 0x18(%rsp), %rcx
movzwl (%rsp,%rcx), %esi
jmp 0x8a45
shlq %cl, %rdx
movq %rdx, (%rsp)
subl %ecx, %eax
movzwl %si, %ecx
movq 0x38(%rsp), %rdi
movslq 0x804(%rdi,%rcx,4), %rsi
movl 0x404(%rdi,%rsi,4), %ecx
cmpl 0x24(%rsp), %esi
jne 0x8ac3
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8aae
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq %rbp, %rdi
callq 0x7983
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
jmp 0x8ab7
shlq %cl, %rdx
movq %rdx, (%rsp)
subl %ecx, %eax
movq 0x30(%rsp), %rcx
movzbl (%rsp,%rcx), %esi
pushq $0x8
popq %rcx
movb %sil, (%r14,%r12)
incl %r13d
movl %r13d, %r12d
jmp 0x88d0
pushq $0x10
popq %rcx
movq $0x0, 0x28(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %r12d, %r12d
cmpl 0xc(%rsp), %r12d
jge 0x8ce7
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8b34
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
jmp 0x8b39
shlq %cl, %rdx
subl %ecx, %eax
movq 0x18(%rsp), %rcx
movzwl (%rsp,%rcx), %esi
movq 0x40(%rsp), %rcx
movslq 0x804(%rcx,%rsi,4), %r13
movl 0x404(%rcx,%r13,4), %ecx
cmpq $0xff, %r13
jne 0x8bbd
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8bad
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
movq 0x18(%rsp), %rcx
movzwl (%rsp,%rcx), %esi
jmp 0x8bb6
shlq %cl, %rdx
movq %rdx, (%rsp)
subl %ecx, %eax
movzwl %si, %r13d
pushq $0x10
popq %rcx
movslq %r12d, %rdi
testl %r13d, %r13d
movl $0x0, %r9d
cmovlel %r9d, %r13d
addl %r12d, %r13d
movslq %r13d, %r12
cmpq %rdi, %r12
je 0x8be1
movb %bl, (%r14,%rdi)
incq %rdi
jmp 0x8bd3
cmpl 0xc(%rsp), %r13d
jge 0x8cb8
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8c39
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
movq 0x18(%rsp), %rcx
movzwl (%rsp,%rcx), %esi
jmp 0x8c42
shlq %cl, %rdx
movq %rdx, (%rsp)
subl %ecx, %eax
movzwl %si, %ecx
movq 0x38(%rsp), %rdi
movslq 0x804(%rdi,%rcx,4), %rsi
movl 0x404(%rdi,%rsi,4), %ecx
cmpl 0x24(%rsp), %esi
jne 0x8cb4
movl %ecx, %r15d
subl %eax, %r15d
jle 0x8c9f
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq 0x10(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x8cc3
movq (%rsp), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
movq %rdx, (%rsp)
pushq $0x20
popq %rax
subl %r15d, %eax
jmp 0x8ca8
shlq %cl, %rdx
movq %rdx, (%rsp)
subl %ecx, %eax
movq 0x30(%rsp), %rcx
movzbl (%rsp,%rcx), %esi
pushq $0x8
popq %rcx
movb %sil, (%r14,%r12)
incl %r13d
movl %r13d, %r12d
jmp 0x8ae5
movq 0x532e(%rip), %rax      # 0xdff8
movq (%rax), %rcx
leaq 0x17b0(%rip), %rdi      # 0xa484
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x1280
pushq $0x1
popq %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq