// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movl %edx, 0x2c(%rsp)
movl %ecx, 0x28(%rsp)
movq %r8, 0x20(%rsp)
movl %r9d, 0x1c(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xcaedc
movq 0x38(%rsp), %rax
movl $0x0, (%rax)
cmpq $0x0, 0x10(%rsp)
je 0xcaef3
movq 0x10(%rsp), %rax
movl $0x0, 0x13e8(%rax)
cmpq $0x0, 0x30(%rsp)
je 0xcaf3f
cmpl $0x0, 0x28(%rsp)
je 0xcaf09
cmpl $0x1, 0x28(%rsp)
jne 0xcaf3f
cmpl $0x0, 0x2c(%rsp)
jl 0xcaf3f
cmpl $0x4, 0x2c(%rsp)
jg 0xcaf3f
cmpq $0x0, 0x20(%rsp)
jne 0xcaf26
cmpl $0x0, 0x1c(%rsp)
jne 0xcaf3f
cmpq $0x0, 0x20(%rsp)
je 0xcaf77
cmpl $0x0, 0x1c(%rsp)
jl 0xcaf3f
cmpl $0x1388, 0x1c(%rsp)     # imm = 0x1388
jle 0xcaf77
cmpq $0x0, 0x38(%rsp)
je 0xcaf52
movq 0x38(%rsp), %rax
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
cmpq $0x0, 0x10(%rsp)
je 0xcaf69
movq 0x10(%rsp), %rax
movl $0xfffffffe, 0x13e8(%rax) # imm = 0xFFFFFFFE
movq $0x0, 0x40(%rsp)
jmp 0xcb191
movq 0x30(%rsp), %rdi
callq 0xbbf0
cmpl $0x0, %eax
je 0xcafbe
cmpq $0x0, 0x38(%rsp)
je 0xcaf99
movq 0x38(%rsp), %rax
movl $0xfffffffa, (%rax)     # imm = 0xFFFFFFFA
cmpq $0x0, 0x10(%rsp)
je 0xcafb0
movq 0x10(%rsp), %rax
movl $0xfffffffa, 0x13e8(%rax) # imm = 0xFFFFFFFA
movq $0x0, 0x40(%rsp)
jmp 0xcb191
movl $0x13f0, %edi           # imm = 0x13F0
callq 0xbcb8
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xcb00d
cmpq $0x0, 0x38(%rsp)
je 0xcafe8
movq 0x38(%rsp), %rax
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
cmpq $0x0, 0x10(%rsp)
je 0xcafff
movq 0x10(%rsp), %rax
movl $0xfffffffd, 0x13e8(%rax) # imm = 0xFFFFFFFD
movq $0x0, 0x40(%rsp)
jmp 0xcb191
cmpq $0x0, 0x38(%rsp)
je 0xcb020
movq 0x38(%rsp), %rax
movl $0x0, (%rax)
cmpq $0x0, 0x10(%rsp)
je 0xcb037
movq 0x10(%rsp), %rax
movl $0x0, 0x13e8(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x13ec(%rax)
movq 0x30(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movl $0x0, 0x1390(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x1394(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x13d0(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x13d8(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x13e0(%rax)
cmpl $0x0, 0x1c(%rsp)
jle 0xcb0ed
movq 0x20(%rsp), %rax
movb (%rax), %dl
movq 0x10(%rsp), %rax
movq 0x10(%rsp), %rcx
movslq 0x1390(%rcx), %rcx
movb %dl, 0x8(%rax,%rcx)
movq 0x10(%rsp), %rax
movl 0x1390(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1390(%rax)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movl 0x1c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xcb09b
movq 0x10(%rsp), %rdi
addq $0x1398, %rdi           # imm = 0x1398
movl 0x2c(%rsp), %esi
movl 0x28(%rsp), %edx
callq 0xc85b0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0xcb150
cmpq $0x0, 0x38(%rsp)
je 0xcb124
movl 0xc(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, (%rax)
cmpq $0x0, 0x10(%rsp)
je 0xcb13b
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x13e8(%rax)
movq 0x10(%rsp), %rdi
callq 0xb760
movq $0x0, 0x40(%rsp)
jmp 0xcb191
movq 0x10(%rsp), %rax
movl 0x1390(%rax), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x13a0(%rax)
movq 0x10(%rsp), %rcx
addq $0x8, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x1398(%rax)
movq 0x10(%rsp), %rax
movb $0x1, 0x13ec(%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
nopl (%rax,%rax)