// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/bzip2-1.0.6/bzlib.c
// Function: BZ2_bzCompressInit
int BZ_API(BZ2_bzCompressInit) 
                    ( bz_stream* strm, 
                     int        blockSize100k,
                     int        verbosity,
                     int        workFactor )
{
   Int32   n;
   EState* s;

   if (!bz_config_ok()) return BZ_CONFIG_ERROR;

   if (strm == NULL || 
       blockSize100k < 1 || blockSize100k > 9 ||
       workFactor < 0 || workFactor > 250)
     return BZ_PARAM_ERROR;

   if (workFactor == 0) workFactor = 30;
   if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
   if (strm->bzfree == NULL) strm->bzfree = default_bzfree;

   s = BZALLOC( sizeof(EState) );
   if (s == NULL) return BZ_MEM_ERROR;
   s->strm = strm;

   s->arr1 = NULL;
   s->arr2 = NULL;
   s->ftab = NULL;

   n       = 100000 * blockSize100k;
   s->arr1 = BZALLOC( n                  * sizeof(UInt32) );
   s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
   s->ftab = BZALLOC( 65537              * sizeof(UInt32) );

   if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
      if (s->arr1 != NULL) BZFREE(s->arr1);
      if (s->arr2 != NULL) BZFREE(s->arr2);
      if (s->ftab != NULL) BZFREE(s->ftab);
      if (s       != NULL) BZFREE(s);
      return BZ_MEM_ERROR;
   }

   s->blockNo           = 0;
   s->state             = BZ_S_INPUT;
   s->mode              = BZ_M_RUNNING;
   s->combinedCRC       = 0;
   s->blockSize100k     = blockSize100k;
   s->nblockMAX         = 100000 * blockSize100k - 19;
   s->verbosity         = verbosity;
   s->workFactor        = workFactor;

   s->block             = (UChar*)s->arr2;
   s->mtfv              = (UInt16*)s->arr1;
   s->zbits             = NULL;
   s->ptr               = (UInt32*)s->arr1;

   strm->state          = s;
   strm->total_in_lo32  = 0;
   strm->total_in_hi32  = 0;
   strm->total_out_lo32 = 0;
   strm->total_out_hi32 = 0;
   init_RL ( s );
   prepare_new_block ( s );
   return BZ_OK;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movl %ecx, 0xc(%rsp)
callq 0xc7f30
cmpl $0x0, %eax
jne 0xc7bdc
movl $0xfffffff7, 0x24(%rsp) # imm = 0xFFFFFFF7
jmp 0xc7f19
cmpq $0x0, 0x18(%rsp)
je 0xc7c03
cmpl $0x1, 0x14(%rsp)
jl 0xc7c03
cmpl $0x9, 0x14(%rsp)
jg 0xc7c03
cmpl $0x0, 0xc(%rsp)
jl 0xc7c03
cmpl $0xfa, 0xc(%rsp)
jle 0xc7c10
movl $0xfffffffe, 0x24(%rsp) # imm = 0xFFFFFFFE
jmp 0xc7f19
cmpl $0x0, 0xc(%rsp)
jne 0xc7c1f
movl $0x1e, 0xc(%rsp)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jne 0xc7c3b
movq 0x18(%rsp), %rax
leaq 0x309(%rip), %rcx       # 0xc7f40
movq %rcx, 0x38(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x40(%rax)
jne 0xc7c57
movq 0x18(%rsp), %rax
leaq 0x31d(%rip), %rcx       # 0xc7f70
movq %rcx, 0x40(%rax)
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movl $0xd9d8, %esi           # imm = 0xD9D8
movl $0x1, %edx
callq *%rax
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0xc7c8d
movl $0xfffffffd, 0x24(%rsp) # imm = 0xFFFFFFFD
jmp 0xc7f19
movq 0x18(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, (%rax)
movq (%rsp), %rax
movq $0x0, 0x18(%rax)
movq (%rsp), %rax
movq $0x0, 0x20(%rax)
movq (%rsp), %rax
movq $0x0, 0x28(%rax)
imull $0x186a0, 0x14(%rsp), %eax # imm = 0x186A0
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movslq 0x8(%rsp), %rcx
shlq $0x2, %rcx
movl %ecx, %esi
movl $0x1, %edx
callq *%rax
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movl 0x8(%rsp), %ecx
addl $0x22, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
movl %ecx, %esi
movl $0x1, %edx
callq *%rax
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movl $0x40004, %esi          # imm = 0x40004
movl $0x1, %edx
callq *%rax
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x28(%rax)
movq (%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0xc7d7a
movq (%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0xc7d7a
movq (%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xc7e1b
movq (%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0xc7da1
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movq (%rsp), %rcx
movq 0x18(%rcx), %rsi
callq *%rax
movq (%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0xc7dc8
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movq (%rsp), %rcx
movq 0x20(%rcx), %rsi
callq *%rax
movq (%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0xc7def
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movq (%rsp), %rcx
movq 0x28(%rcx), %rsi
callq *%rax
cmpq $0x0, (%rsp)
je 0xc7e0e
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rdi
movq (%rsp), %rsi
callq *%rax
movl $0xfffffffd, 0x24(%rsp) # imm = 0xFFFFFFFD
jmp 0xc7f19
movq (%rsp), %rax
movl $0x0, 0x294(%rax)
movq (%rsp), %rax
movl $0x2, 0xc(%rax)
movq (%rsp), %rax
movl $0x2, 0x8(%rax)
movq (%rsp), %rax
movl $0x0, 0x28c(%rax)
movl 0x14(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0x298(%rax)
imull $0x186a0, 0x14(%rsp), %ecx # imm = 0x186A0
subl $0x13, %ecx
movq (%rsp), %rax
movl %ecx, 0x70(%rax)
movl 0x10(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0x290(%rax)
movl 0xc(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0x58(%rax)
movq (%rsp), %rax
movq 0x20(%rax), %rcx
movq (%rsp), %rax
movq %rcx, 0x40(%rax)
movq (%rsp), %rax
movq 0x18(%rax), %rcx
movq (%rsp), %rax
movq %rcx, 0x48(%rax)
movq (%rsp), %rax
movq $0x0, 0x50(%rax)
movq (%rsp), %rax
movq 0x18(%rax), %rcx
movq (%rsp), %rax
movq %rcx, 0x38(%rax)
movq (%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x18(%rsp), %rax
movl $0x0, 0xc(%rax)
movq 0x18(%rsp), %rax
movl $0x0, 0x10(%rax)
movq 0x18(%rsp), %rax
movl $0x0, 0x24(%rax)
movq 0x18(%rsp), %rax
movl $0x0, 0x28(%rax)
movq (%rsp), %rdi
callq 0xc7fa0
movq (%rsp), %rdi
callq 0xc7fc0
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)