// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/bzip2-1.0.6/compress.c
// Function: BZ2_compressBlock
void BZ2_compressBlock ( EState* s, Bool is_last_block )
{
   if (s->nblock > 0) {

      BZ_FINALISE_CRC ( s->blockCRC );
      s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
      s->combinedCRC ^= s->blockCRC;
      if (s->blockNo > 1) s->numZ = 0;

      if (s->verbosity >= 2)
         VPrintf4( "    block %d: crc = 0x%08x, "
                   "combined CRC = 0x%08x, size = %d\n",
                   s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );

      BZ2_blockSort ( s );
   }

   s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);

   /*-- If this is the first block, create the stream header. --*/
   if (s->blockNo == 1) {
      BZ2_bsInitWrite ( s );
      bsPutUChar ( s, BZ_HDR_B );
      bsPutUChar ( s, BZ_HDR_Z );
      bsPutUChar ( s, BZ_HDR_h );
      bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) );
   }

   if (s->nblock > 0) {

      bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
      bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
      bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );

      /*-- Now the block's CRC, so it is in a known place. --*/
      bsPutUInt32 ( s, s->blockCRC );

      /*-- 
         Now a single bit indicating (non-)randomisation. 
         As of version 0.9.5, we use a better sorting algorithm
         which makes randomisation unnecessary.  So always set
         the randomised bit to 'no'.  Of course, the decoder
         still needs to be able to handle randomised blocks
         so as to maintain backwards compatibility with
         older versions of bzip2.
      --*/
      bsW(s,1,0);

      bsW ( s, 24, s->origPtr );
      generateMTFValues ( s );
      sendMTFValues ( s );
   }


   /*-- If this is the last block, add the stream trailer. --*/
   if (is_last_block) {

      bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
      bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
      bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
      bsPutUInt32 ( s, s->combinedCRC );
      if (s->verbosity >= 2)
         VPrintf1( "    final combined CRC = 0x%08x\n   ", s->combinedCRC );
      bsFinishWrite ( s );
   }
}

// Assembly:
subq $0x18, %rsp
movb %sil, %al
movq %rdi, 0x10(%rsp)
movb %al, 0xf(%rsp)
movq 0x10(%rsp), %rax
cmpl $0x0, 0x6c(%rax)
jle 0xfc531
movq 0x10(%rsp), %rax
movl 0x288(%rax), %ecx
xorl $-0x1, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x288(%rax)
movq 0x10(%rsp), %rax
movl 0x28c(%rax), %ecx
shll %ecx
movq 0x10(%rsp), %rax
movl 0x28c(%rax), %eax
shrl $0x1f, %eax
orl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x28c(%rax)
movq 0x10(%rsp), %rax
movl 0x288(%rax), %ecx
movq 0x10(%rsp), %rax
xorl 0x28c(%rax), %ecx
movl %ecx, 0x28c(%rax)
movq 0x10(%rsp), %rax
cmpl $0x1, 0x294(%rax)
jle 0xfc4d6
movq 0x10(%rsp), %rax
movl $0x0, 0x74(%rax)
movq 0x10(%rsp), %rax
cmpl $0x2, 0x290(%rax)
jl 0xfc527
movq 0xb7aed(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movl 0x294(%rax), %edx
movq 0x10(%rsp), %rax
movl 0x288(%rax), %ecx
movq 0x10(%rsp), %rax
movl 0x28c(%rax), %r8d
movq 0x10(%rsp), %rax
movl 0x6c(%rax), %r9d
leaq 0x8065c(%rip), %rsi     # 0x17cb7c
movb $0x0, %al
callq 0xb890
movq 0x10(%rsp), %rdi
callq 0x1526e0
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x10(%rsp), %rax
movslq 0x6c(%rax), %rax
addq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x10(%rsp), %rax
cmpl $0x1, 0x294(%rax)
jne 0xfc5af
movq 0x10(%rsp), %rdi
callq 0xfc410
movq 0x10(%rsp), %rdi
movl $0x42, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x5a, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x68, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movl 0x298(%rax), %eax
addl $0x30, %eax
movzbl %al, %esi
callq 0xfc730
movq 0x10(%rsp), %rax
cmpl $0x0, 0x6c(%rax)
jle 0xfc669
movq 0x10(%rsp), %rdi
movl $0x31, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x41, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x59, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x26, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x53, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x59, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movl 0x288(%rax), %esi
callq 0xfc760
movq 0x10(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0xfc7f0
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movl 0x30(%rax), %edx
movl $0x18, %esi
callq 0xfc7f0
movq 0x10(%rsp), %rdi
callq 0xfc8b0
movq 0x10(%rsp), %rdi
callq 0xfccb0
cmpb $0x0, 0xf(%rsp)
je 0xfc71e
movq 0x10(%rsp), %rdi
movl $0x17, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x72, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x45, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x38, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x50, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movl $0x90, %esi
callq 0xfc730
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movl 0x28c(%rax), %esi
callq 0xfc760
movq 0x10(%rsp), %rax
cmpl $0x2, 0x290(%rax)
jl 0xfc714
movq 0xb78e0(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movl 0x28c(%rax), %edx
leaq 0x804ad(%rip), %rsi     # 0x17cbba
movb $0x0, %al
callq 0xb890
movq 0x10(%rsp), %rdi
callq 0x101710
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)