// File: /workspace/github_c_makefile_star2_O0/coapp-packages[P]bzip2/bzip2.c
// Function: uncompressStream
static 
Bool uncompressStream ( FILE *zStream, FILE *stream )
{
   BZFILE* bzf = NULL;
   Int32   bzerr, bzerr_dummy, ret, nread, streamNo, i;
   UChar   obuf[5000];
   UChar   unused[BZ_MAX_UNUSED];
   Int32   nUnused;
   void*   unusedTmpV;
   UChar*  unusedTmp;

   nUnused = 0;
   streamNo = 0;

   SET_BINARY_MODE(stream);
   SET_BINARY_MODE(zStream);

   if (ferror(stream)) goto errhandler_io;
   if (ferror(zStream)) goto errhandler_io;

   while (True) {

      bzf = BZ2_bzReadOpen ( 
               &bzerr, zStream, verbosity, 
               (int)smallMode, unused, nUnused
            );
      if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
      streamNo++;

      while (bzerr == BZ_OK) {
         nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
         if (bzerr == BZ_DATA_ERROR_MAGIC) goto trycat;
         if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0)
            fwrite ( obuf, sizeof(UChar), nread, stream );
         if (ferror(stream)) goto errhandler_io;
      }
      if (bzerr != BZ_STREAM_END) goto errhandler;

      BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
      if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );

      unusedTmp = (UChar*)unusedTmpV;
      for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];

      BZ2_bzReadClose ( &bzerr, bzf );
      if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );

      if (nUnused == 0 && myfeof(zStream)) break;
   }

   closeok:
   if (ferror(zStream)) goto errhandler_io;
   if (stream != stdout) {
      Int32 fd = fileno ( stream );
      if (fd < 0) goto errhandler_io;
      applySavedFileAttrToOutputFile ( fd );
   }
   ret = fclose ( zStream );
   if (ret == EOF) goto errhandler_io;

   if (ferror(stream)) goto errhandler_io;
   ret = fflush ( stream );
   if (ret != 0) goto errhandler_io;
   if (stream != stdout) {
      ret = fclose ( stream );
      outputHandleJustInCase = NULL;
      if (ret == EOF) goto errhandler_io;
   }
   outputHandleJustInCase = NULL;
   if (verbosity >= 2) fprintf ( stderr, "\n    " );
   return True;

   trycat: 
   if (forceOverwrite) {
      rewind(zStream);
      while (True) {
      	 if (myfeof(zStream)) break;
      	 nread = fread ( obuf, sizeof(UChar), 5000, zStream );
      	 if (ferror(zStream)) goto errhandler_io;
      	 if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream );
      	 if (ferror(stream)) goto errhandler_io;
      }
      goto closeok;
   }
  
   errhandler:
   BZ2_bzReadClose ( &bzerr_dummy, bzf );
   switch (bzerr) {
      case BZ_CONFIG_ERROR:
         configError(); break;
      case BZ_IO_ERROR:
         errhandler_io:
         ioError(); break;
      case BZ_DATA_ERROR:
         crcError();
      case BZ_MEM_ERROR:
         outOfMemory();
      case BZ_UNEXPECTED_EOF:
         compressedStreamEOF();
      case BZ_DATA_ERROR_MAGIC:
         if (zStream != stdin) fclose(zStream);
         if (stream != stdout) fclose(stream);
         if (streamNo == 1) {
            return False;
         } else {
            if (noisy)
            fprintf ( stderr, 
                      "\n%s: %s: trailing garbage after EOF ignored\n",
                      progName, inName );
            return True;       
         }
      default:
         panic ( "decompress:unexpected error" );
   }

   panic ( "decompress:end" );
   return True; /*notreached*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2780, %rsp           # imm = 0x2780
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x2754(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x564f
jmp 0x5994
movq -0x10(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x5662
jmp 0x5994
jmp 0x5664
movq -0x10(%rbp), %rsi
movl 0x1880e(%rip), %edx     # 0x1de7c
movzbl 0x18803(%rip), %ecx     # 0x1de78
leaq -0x2750(%rbp), %r8
movl -0x2754(%rbp), %r9d
leaq -0x24(%rbp), %rdi
callq 0x8d20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x569d
cmpl $0x0, -0x24(%rbp)
je 0x56a2
jmp 0x5951
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x5718
movq -0x20(%rbp), %rsi
leaq -0x13c0(%rbp), %rdx
leaq -0x24(%rbp), %rdi
movl $0x1388, %ecx           # imm = 0x1388
callq 0x90a0
movl %eax, -0x30(%rbp)
cmpl $-0x5, -0x24(%rbp)
jne 0x56d8
jmp 0x58cb
cmpl $0x0, -0x24(%rbp)
je 0x56e4
cmpl $0x4, -0x24(%rbp)
jne 0x5703
cmpl $0x0, -0x30(%rbp)
jle 0x5703
leaq -0x13c0(%rbp), %rdi
movslq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0x2250
movq -0x18(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x5716
jmp 0x5994
jmp 0x56ab
cmpl $0x4, -0x24(%rbp)
je 0x5723
jmp 0x5951
movq -0x20(%rbp), %rsi
leaq -0x24(%rbp), %rdi
leaq -0x2760(%rbp), %rdx
leaq -0x2754(%rbp), %rcx
callq 0x9440
cmpl $0x0, -0x24(%rbp)
je 0x5750
leaq 0x141b5(%rip), %rdi     # 0x19900
callq 0x4ad0
movq -0x2760(%rbp), %rax
movq %rax, -0x2768(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x2754(%rbp), %eax
jge 0x5794
movq -0x2768(%rbp), %rax
movslq -0x38(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x38(%rbp), %rax
movb %cl, -0x2750(%rbp,%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5765
movq -0x20(%rbp), %rsi
leaq -0x24(%rbp), %rdi
callq 0x8fd0
cmpl $0x0, -0x24(%rbp)
je 0x57b3
leaq 0x14152(%rip), %rdi     # 0x19900
callq 0x4ad0
cmpl $0x0, -0x2754(%rbp)
jne 0x57cf
movq -0x10(%rbp), %rdi
callq 0x5220
movzbl %al, %eax
cmpl $0x0, %eax
je 0x57cf
jmp 0x57d4
jmp 0x5664
jmp 0x57d6
movq -0x10(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x57e9
jmp 0x5994
movq -0x18(%rbp), %rax
movq 0x177dc(%rip), %rcx     # 0x1cfd0
cmpq (%rcx), %rax
je 0x5821
movq -0x18(%rbp), %rdi
callq 0x2190
movl %eax, -0x276c(%rbp)
cmpl $0x0, -0x276c(%rbp)
jge 0x5816
jmp 0x5994
movl -0x276c(%rbp), %edi
callq 0x5260
movq -0x10(%rbp), %rdi
callq 0x20e0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x5838
jmp 0x5994
movq -0x18(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x584b
jmp 0x5994
movq -0x18(%rbp), %rdi
callq 0x21b0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5862
jmp 0x5994
movq -0x18(%rbp), %rax
movq 0x17763(%rip), %rcx     # 0x1cfd0
cmpq (%rcx), %rax
je 0x5896
movq -0x18(%rbp), %rdi
callq 0x20e0
movl %eax, -0x2c(%rbp)
movq $0x0, 0x185e7(%rip) # 0x1de70
cmpl $-0x1, -0x2c(%rbp)
jne 0x5894
jmp 0x5994
jmp 0x5896
movq $0x0, 0x185cf(%rip) # 0x1de70
cmpl $0x2, 0x185d4(%rip)     # 0x1de7c
jl 0x58c2
movq 0x17747(%rip), %rax     # 0x1cff8
movq (%rax), %rdi
leaq 0x14060(%rip), %rsi     # 0x1991b
movb $0x0, %al
callq 0x2170
movb $0x1, -0x1(%rbp)
jmp 0x5a27
cmpb $0x0, 0x185a8(%rip)     # 0x1de7a
je 0x594f
movq -0x10(%rbp), %rdi
callq 0x2100
movq -0x10(%rbp), %rdi
callq 0x5220
cmpb $0x0, %al
je 0x58ec
jmp 0x594a
leaq -0x13c0(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x1388, %edx           # imm = 0x1388
callq 0x20d0
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x5919
jmp 0x5994
cmpl $0x0, -0x30(%rbp)
jle 0x5938
leaq -0x13c0(%rbp), %rdi
movslq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0x2250
movq -0x18(%rbp), %rdi
callq 0x20b0
cmpl $0x0, %eax
je 0x5948
jmp 0x5994
jmp 0x58dd
jmp 0x57d6
jmp 0x5951
movq -0x20(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8fd0
movl -0x24(%rbp), %eax
addl $0x9, %eax
movl %eax, %ecx
movq %rcx, -0x2778(%rbp)
subl $0x6, %eax
ja 0x5a1b
movq -0x2778(%rbp), %rax
leaq 0x127a8(%rip), %rcx     # 0x1812c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x5490
jmp 0x5994
callq 0x51e0
callq 0x5a40
callq 0x4a90
callq 0x5a80
movq -0x10(%rbp), %rax
movq 0x17625(%rip), %rcx     # 0x1cfd8
cmpq (%rcx), %rax
je 0x59c1
movq -0x10(%rbp), %rdi
callq 0x20e0
movq -0x18(%rbp), %rax
movq 0x17604(%rip), %rcx     # 0x1cfd0
cmpq (%rcx), %rax
je 0x59da
movq -0x18(%rbp), %rdi
callq 0x20e0
cmpl $0x1, -0x34(%rbp)
jne 0x59e6
movb $0x0, -0x1(%rbp)
jmp 0x5a27
cmpb $0x0, 0x1848e(%rip)     # 0x1de7b
je 0x5a15
movq 0x17602(%rip), %rax     # 0x1cff8
movq (%rax), %rdi
movq 0x190d0(%rip), %rdx     # 0x1ead0
leaq 0x13f1a(%rip), %rsi     # 0x19921
leaq 0x18492(%rip), %rcx     # 0x1dea0
movb $0x0, %al
callq 0x2170
movb $0x1, -0x1(%rbp)
jmp 0x5a27
leaq 0x13f2c(%rip), %rdi     # 0x1994e
callq 0x4ad0
movb -0x1(%rbp), %al
addq $0x2780, %rsp           # imm = 0x2780
popq %rbp
retq
nopw %cs:(%rax,%rax)