// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/bzip2-1.0.6/bzlib.c
// Function: BZ2_bzReadOpen
BZFILE* BZ_API(BZ2_bzReadOpen) 
                   ( int*  bzerror, 
                     FILE* f, 
                     int   verbosity,
                     int   small,
                     void* unused,
                     int   nUnused )
{
   bzFile* bzf = NULL;
   int     ret;

   BZ_SETERR(BZ_OK);

   if (f == NULL || 
       (small != 0 && small != 1) ||
       (verbosity < 0 || verbosity > 4) ||
       (unused == NULL && nUnused != 0) ||
       (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED)))
      { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };

   if (ferror(f))
      { BZ_SETERR(BZ_IO_ERROR); return NULL; };

   bzf = malloc ( sizeof(bzFile) );
   if (bzf == NULL) 
      { BZ_SETERR(BZ_MEM_ERROR); return NULL; };

   BZ_SETERR(BZ_OK);

   bzf->initialisedOk = False;
   bzf->handle        = f;
   bzf->bufN          = 0;
   bzf->writing       = False;
   bzf->strm.bzalloc  = NULL;
   bzf->strm.bzfree   = NULL;
   bzf->strm.opaque   = NULL;
   
   while (nUnused > 0) {
      bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
      unused = ((void*)( 1 + ((UChar*)(unused))  ));
      nUnused--;
   }

   ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
   if (ret != BZ_OK)
      { BZ_SETERR(ret); free(bzf); return NULL; };

   bzf->strm.avail_in = bzf->bufN;
   bzf->strm.next_in  = bzf->buf;

   bzf->initialisedOk = True;
   return bzf;   
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %r12d
movq %r8, %r13
movl %ecx, %r14d
movl %edx, %r15d
movq %rsi, %rbp
movq %rdi, %rbx
testq %rdi, %rdi
je 0x796d3
andl $0x0, (%rbx)
testq %rbp, %rbp
je 0x7970e
cmpl $0x2, %r14d
setae %al
cmpl $0x5, %r15d
setae %cl
orb %al, %cl
jne 0x7970e
testq %r13, %r13
sete %al
testl %r12d, %r12d
setne %cl
testb %cl, %al
jne 0x7970e
testq %r13, %r13
sete %al
cmpl $0x1389, %r12d          # imm = 0x1389
setb %cl
orb %al, %cl
jne 0x7972e
testq %rbx, %rbx
je 0x79719
movl $0xfffffffe, (%rbx)     # imm = 0xFFFFFFFE
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0xbc20
testl %eax, %eax
je 0x79747
testq %rbx, %rbx
je 0x79719
movl $0xfffffffa, (%rbx)     # imm = 0xFFFFFFFA
jmp 0x79719
movl %r14d, 0x4(%rsp)
movl $0x13f0, %edi           # imm = 0x13F0
callq 0xbce8
testq %rax, %rax
je 0x797fa
movq %rax, %r14
testq %rbx, %rbx
je 0x7976a
andl $0x0, (%rbx)
andl $0x0, 0x13e8(%r14)
xorl %eax, %eax
movb %al, 0x13ec(%r14)
movq %rbp, (%r14)
andl $0x0, 0x1390(%r14)
movb %al, 0x1394(%r14)
leaq 0x8(%r14), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x13d0(%r14)
andq $0x0, 0x13e0(%r14)
testl %r12d, %r12d
jle 0x797cc
movb (%r13), %cl
cltq
movb %cl, 0x8(%r14,%rax)
movl 0x1390(%r14), %eax
incl %eax
movl %eax, 0x1390(%r14)
incq %r13
decl %r12d
jmp 0x797a4
movq %r14, %rdi
addq $0x1398, %rdi           # imm = 0x1398
movl %r15d, %esi
movl 0x4(%rsp), %edx
callq 0x782fc
testl %eax, %eax
je 0x7980e
testq %rbx, %rbx
je 0x797ed
movl %eax, (%rbx)
movq %r14, %rdi
callq 0xb790
jmp 0x79719
testq %rbx, %rbx
je 0x79719
movl $0xfffffffd, (%rbx)     # imm = 0xFFFFFFFD
jmp 0x79719
movl 0x1390(%r14), %eax
movl %eax, 0x13a0(%r14)
movq %rbp, 0x1398(%r14)
movb $0x1, 0x13ec(%r14)
jmp 0x7971c