// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/QV.c
// Function: Encode_Run
static void Encode_Run(HScheme *neme, HScheme *reme, FILE *out, uint8 *read, int rlen, int rchar)
{ uint32  x, c, ocode;
  int     n, h, k, olen, llen;
  int    *nlens, *rlens;
  uint32 *nbits, *rbits;
  uint32  nspec, rspec;
  int     nslen, rslen;

  nlens = neme->codelens;
  nbits = neme->codebits;
  rlens = reme->codelens;
  rbits = reme->codebits;

  if (neme->type == 2)
    { nspec = nbits[255];
      nslen = nlens[255];
    }
  else
    nspec = nslen = 0x7fffffff;

  rspec = rbits[255];
  rslen = rlens[255];

  llen  = 0;
  olen  = 0;
  ocode = 0;
  k     = 0;
  while (k < rlen)
    { h = k;
      while (k < rlen && read[k] == rchar)
        k += 1;
      if (k-h >= 255)
        x = 255;
      else
        x = k-h;
      n = rlens[x];
      c = rbits[x];
      OCODE(n,c);
      if (c == rspec && n == rslen)
        OCODE(16,k-h);
      if (k < rlen)
        { x = read[k];
          n = nlens[x];
          c = nbits[x];
          OCODE(n,c);
          if (c == nspec && n == nslen)
            OCODE(8,x);
          k += 1;
        }
    }

  if (olen > 0)
    { fwrite(&ocode,sizeof(uint32),1,out);
      if (llen > 16 && olen > llen)
        fwrite(&ocode,sizeof(uint32),1,out);
    }
  else if (llen > 16)
    fwrite(&ocode,sizeof(uint32),1,out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x8(%rbp), %rax
addq $0x404, %rax            # imm = 0x404
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
addq $0x404, %rax            # imm = 0x404
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jne 0xbdcc
movq -0x60(%rbp), %rax
movl 0x3fc(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x50(%rbp), %rax
movl 0x3fc(%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0xbdda
movl $0x7fffffff, -0x74(%rbp) # imm = 0x7FFFFFFF
movl $0x7fffffff, -0x6c(%rbp) # imm = 0x7FFFFFFF
movq -0x68(%rbp), %rax
movl 0x3fc(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x58(%rbp), %rax
movl 0x3fc(%rax), %eax
movl %eax, -0x78(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xc168
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x24(%rbp), %ecx
movb %al, -0x99(%rbp)
jge 0xbe4a
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl -0x28(%rbp), %eax
sete %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0xbe56
jmp 0xbe61
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xbe22
movl -0x40(%rbp), %eax
subl -0x3c(%rbp), %eax
cmpl $0xff, %eax
jl 0xbe77
movl $0xff, -0x2c(%rbp)
jmp 0xbe80
movl -0x40(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x58(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x68(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x44(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x20, -0x7c(%rbp)
jl 0xbf04
movl -0x7c(%rbp), %eax
subl $0x20, %eax
movl %eax, -0x44(%rbp)
movl -0x80(%rbp), %eax
movl -0x44(%rbp), %ecx
shrl %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
cmpl $0x0, -0x44(%rbp)
jle 0xbefb
movl -0x80(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
movl %eax, -0x34(%rbp)
jmp 0xbf02
movl $0x0, -0x34(%rbp)
jmp 0xbf1d
movl -0x7c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x80(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x70(%rbp), %eax
jne 0xbfd5
movl -0x38(%rbp), %eax
cmpl -0x78(%rbp), %eax
jne 0xbfd5
movl -0x44(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x84(%rbp)
movl -0x40(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x20, -0x84(%rbp)
jl 0xbfb4
movl -0x84(%rbp), %eax
subl $0x20, %eax
movl %eax, -0x44(%rbp)
movl -0x88(%rbp), %eax
movl -0x44(%rbp), %ecx
shrl %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
cmpl $0x0, -0x44(%rbp)
jle 0xbfab
movl -0x88(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
movl %eax, -0x34(%rbp)
jmp 0xbfb2
movl $0x0, -0x34(%rbp)
jmp 0xbfd3
movl -0x84(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x88(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xbfd5
movl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xc163
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movq -0x50(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x44(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x20, -0x8c(%rbp)
jl 0xc086
movl -0x8c(%rbp), %eax
subl $0x20, %eax
movl %eax, -0x44(%rbp)
movl -0x90(%rbp), %eax
movl -0x44(%rbp), %ecx
shrl %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
cmpl $0x0, -0x44(%rbp)
jle 0xc07d
movl -0x90(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
movl %eax, -0x34(%rbp)
jmp 0xc084
movl $0x0, -0x34(%rbp)
jmp 0xc0a5
movl -0x8c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x90(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jne 0xc15a
movl -0x38(%rbp), %eax
cmpl -0x74(%rbp), %eax
jne 0xc15a
movl -0x44(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x94(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x20, -0x94(%rbp)
jl 0xc139
movl -0x94(%rbp), %eax
subl $0x20, %eax
movl %eax, -0x44(%rbp)
movl -0x98(%rbp), %eax
movl -0x44(%rbp), %ecx
shrl %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
cmpl $0x0, -0x44(%rbp)
jle 0xc130
movl -0x98(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
movl %eax, -0x34(%rbp)
jmp 0xc137
movl $0x0, -0x34(%rbp)
jmp 0xc158
movl -0x94(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x98(%rbp), %eax
movl $0x20, %ecx
subl -0x44(%rbp), %ecx
shll %cl, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xc15a
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xbe10
cmpl $0x0, -0x44(%rbp)
jle 0xc1ac
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
cmpl $0x10, -0x48(%rbp)
jle 0xc1aa
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0xc1aa
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
jmp 0xc1cb
cmpl $0x10, -0x48(%rbp)
jle 0xc1c9
movq -0x18(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1270
jmp 0xc1cb
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)