// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/bzip2-1.0.6/bzlib.c
// Function: BZ2_bzDecompress
int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
{
   Bool    corrupt;
   DState* s;
   if (strm == NULL) return BZ_PARAM_ERROR;
   s = strm->state;
   if (s == NULL) return BZ_PARAM_ERROR;
   if (s->strm != strm) return BZ_PARAM_ERROR;

   while (True) {
      if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
      if (s->state == BZ_X_OUTPUT) {
         if (s->smallDecompress)
            corrupt = unRLE_obuf_to_output_SMALL ( s ); else
            corrupt = unRLE_obuf_to_output_FAST  ( s );
         if (corrupt) return BZ_DATA_ERROR;
         if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
            BZ_FINALISE_CRC ( s->calculatedBlockCRC );
            if (s->verbosity >= 3) 
               VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, 
                          s->calculatedBlockCRC );
            if (s->verbosity >= 2) VPrintf0 ( "]" );
            if (s->calculatedBlockCRC != s->storedBlockCRC)
               return BZ_DATA_ERROR;
            s->calculatedCombinedCRC 
               = (s->calculatedCombinedCRC << 1) | 
                    (s->calculatedCombinedCRC >> 31);
            s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
            s->state = BZ_X_BLKHDR_1;
         } else {
            return BZ_OK;
         }
      }
      if (s->state >= BZ_X_MAGIC_1) {
         Int32 r = BZ2_decompress ( s );
         if (r == BZ_STREAM_END) {
            if (s->verbosity >= 3)
               VPrintf2 ( "\n    combined CRCs: stored = 0x%08x, computed = 0x%08x", 
                          s->storedCombinedCRC, s->calculatedCombinedCRC );
            if (s->calculatedCombinedCRC != s->storedCombinedCRC)
               return BZ_DATA_ERROR;
            return r;
         }
         if (s->state != BZ_X_OUTPUT) return r;
      }
   }

   AssertH ( 0, 6001 );

   return 0;  /*NOTREACHED*/
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0xc87fe
movl $0xfffffffe, 0x24(%rsp) # imm = 0xFFFFFFFE
jmp 0xc8a73
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0xc8821
movl $0xfffffffe, 0x24(%rsp) # imm = 0xFFFFFFFE
jmp 0xc8a73
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq 0x18(%rsp), %rax
je 0xc883d
movl $0xfffffffe, 0x24(%rsp) # imm = 0xFFFFFFFE
jmp 0xc8a73
jmp 0xc883f
movq 0x8(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jne 0xc8857
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xc8a73
movq 0x8(%rsp), %rax
cmpl $0x2, 0x8(%rax)
jne 0xc89ce
movq 0x8(%rsp), %rax
cmpb $0x0, 0x2c(%rax)
je 0xc8881
movq 0x8(%rsp), %rdi
callq 0xc8a80
movb %al, 0x17(%rsp)
jmp 0xc888f
movq 0x8(%rsp), %rdi
callq 0xc98a0
movb %al, 0x17(%rsp)
cmpb $0x0, 0x17(%rsp)
je 0xc88a3
movl $0xfffffffc, 0x24(%rsp) # imm = 0xFFFFFFFC
jmp 0xc8a73
movq 0x8(%rsp), %rax
movl 0x444(%rax), %eax
movq 0x8(%rsp), %rcx
movl 0xfa50(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0xc89bf
movq 0x8(%rsp), %rax
cmpl $0x0, 0x10(%rax)
jne 0xc89bf
movq 0x8(%rsp), %rax
movl 0xc70(%rax), %ecx
xorl $-0x1, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0xc70(%rax)
movq 0x8(%rsp), %rax
cmpl $0x3, 0x34(%rax)
jl 0xc8925
movq 0xeb6da(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movl 0xc68(%rax), %edx
movq 0x8(%rsp), %rax
movl 0xc70(%rax), %ecx
leaq 0xad6ea(%rip), %rsi     # 0x176008
movb $0x0, %al
callq 0xb890
movq 0x8(%rsp), %rax
cmpl $0x2, 0x34(%rax)
jl 0xc8948
movq 0xeb6a1(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0xa27e8(%rip), %rsi     # 0x16b129
movb $0x0, %al
callq 0xb890
movq 0x8(%rsp), %rax
movl 0xc70(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0xc68(%rcx), %eax
je 0xc896d
movl $0xfffffffc, 0x24(%rsp) # imm = 0xFFFFFFFC
jmp 0xc8a73
movq 0x8(%rsp), %rax
movl 0xc74(%rax), %ecx
shll %ecx
movq 0x8(%rsp), %rax
movl 0xc74(%rax), %eax
shrl $0x1f, %eax
orl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0xc74(%rax)
movq 0x8(%rsp), %rax
movl 0xc70(%rax), %ecx
movq 0x8(%rsp), %rax
xorl 0xc74(%rax), %ecx
movl %ecx, 0xc74(%rax)
movq 0x8(%rsp), %rax
movl $0xe, 0x8(%rax)
jmp 0xc89cc
movl $0x0, 0x24(%rsp)
jmp 0xc8a73
jmp 0xc89ce
movq 0x8(%rsp), %rax
cmpl $0xa, 0x8(%rax)
jl 0xc8a6e
movq 0x8(%rsp), %rdi
callq 0x101800
movl %eax, 0x4(%rsp)
cmpl $0x4, 0x4(%rsp)
jne 0xc8a57
movq 0x8(%rsp), %rax
cmpl $0x3, 0x34(%rax)
jl 0xc8a2b
movq 0xeb5d4(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movl 0xc6c(%rax), %edx
movq 0x8(%rsp), %rax
movl 0xc74(%rax), %ecx
leaq 0xad5f6(%rip), %rsi     # 0x17601a
movb $0x0, %al
callq 0xb890
movq 0x8(%rsp), %rax
movl 0xc74(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0xc6c(%rcx), %eax
je 0xc8a4d
movl $0xfffffffc, 0x24(%rsp) # imm = 0xFFFFFFFC
jmp 0xc8a73
movl 0x4(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0xc8a73
movq 0x8(%rsp), %rax
cmpl $0x2, 0x8(%rax)
je 0xc8a6c
movl 0x4(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0xc8a73
jmp 0xc8a6e
jmp 0xc883f
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)