// File: /workspace/github_c_makefile_star2_O3/coapp-packages[P]bzip2/bzip2.c
// Function: uncompress
static 
void uncompress ( Char *name )
{
   FILE  *inStr;
   FILE  *outStr;
   Int32 n, i;
   Bool  magicNumberOK;
   Bool  cantGuess;
   struct MY_STAT statBuf;

   deleteOutputOnInterrupt = False;

   if (name == NULL && srcMode != SM_I2O)
      panic ( "uncompress: bad modes\n" );

   cantGuess = False;
   switch (srcMode) {
      case SM_I2O: 
         copyFileName ( inName, (Char*)"(stdin)" );
         copyFileName ( outName, (Char*)"(stdout)" ); 
         break;
      case SM_F2F: 
         copyFileName ( inName, name );
         copyFileName ( outName, name );
         for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
            if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
               goto zzz; 
         cantGuess = True;
         strcat ( outName, ".out" );
         break;
      case SM_F2O: 
         copyFileName ( inName, name );
         copyFileName ( outName, (Char*)"(stdout)" ); 
         break;
   }

   zzz:
   if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
      if (noisy)
      fprintf ( stderr, "%s: There are no files matching `%s'.\n",
                progName, inName );
      setExit(1);
      return;
   }
   if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
      fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
                progName, inName, strerror(errno) );
      setExit(1);
      return;
   }
   if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
      MY_STAT(inName, &statBuf);
      if ( MY_S_ISDIR(statBuf.st_mode) ) {
         fprintf( stderr,
                  "%s: Input file %s is a directory.\n",
                  progName,inName);
         setExit(1);
         return;
      }
   }
   if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
      if (noisy)
      fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
                progName, inName );
      setExit(1);
      return;
   }
   if ( /* srcMode == SM_F2F implied && */ cantGuess ) {
      if (noisy)
      fprintf ( stderr, 
                "%s: Can't guess original name for %s -- using %s\n",
                progName, inName, outName );
      /* just a warning, no return */
   }   
   if ( srcMode == SM_F2F && fileExists ( outName ) ) {
      if (forceOverwrite) {
	remove(outName);
      } else {
        fprintf ( stderr, "%s: Output file %s already exists.\n",
                  progName, outName );
        setExit(1);
        return;
      }
   }
   if ( srcMode == SM_F2F && !forceOverwrite &&
        (n=countHardLinks ( inName ) ) > 0) {
      fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
                progName, inName, n, n > 1 ? "s" : "" );
      setExit(1);
      return;
   }

   if ( srcMode == SM_F2F ) {
      /* Save the file's meta-info before we open it.  Doing it later
         means we mess up the access times. */
      saveInputFileMetaInfo ( inName );
   }

   switch ( srcMode ) {

      case SM_I2O:
         inStr = stdin;
         outStr = stdout;
         if ( isatty ( fileno ( stdin ) ) ) {
            fprintf ( stderr,
                      "%s: I won't read compressed data from a terminal.\n",
                      progName );
            fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
                              progName, progName );
            setExit(1);
            return;
         };
         break;

      case SM_F2O:
         inStr = fopen ( inName, "rb" );
         outStr = stdout;
         if ( inStr == NULL ) {
            fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
                      progName, inName, strerror(errno) );
            if ( inStr != NULL ) fclose ( inStr );
            setExit(1);
            return;
         };
         break;

      case SM_F2F:
         inStr = fopen ( inName, "rb" );
         outStr = fopen_output_safely ( outName, "wb" );
         if ( outStr == NULL) {
            fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
                      progName, outName, strerror(errno) );
            if ( inStr != NULL ) fclose ( inStr );
            setExit(1);
            return;
         }
         if ( inStr == NULL ) {
            fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
                      progName, inName, strerror(errno) );
            if ( outStr != NULL ) fclose ( outStr );
            setExit(1);
            return;
         };
         break;

      default:
         panic ( "uncompress: bad srcMode" );
         break;
   }

   if (verbosity >= 1) {
      fprintf ( stderr, "  %s: ", inName );
      pad ( inName );
      fflush ( stderr );
   }

   /*--- Now the input and output handles are sane.  Do the Biz. ---*/
   outputHandleJustInCase = outStr;
   deleteOutputOnInterrupt = True;
   magicNumberOK = uncompressStream ( inStr, outStr );
   outputHandleJustInCase = NULL;

   /*--- If there was an I/O error, we won't get here. ---*/
   if ( magicNumberOK ) {
      if ( srcMode == SM_F2F ) {
         applySavedTimeInfoToOutputFile ( outName );
         deleteOutputOnInterrupt = False;
         if ( !keepInputFiles ) {
            IntNative retVal = remove ( inName );
            ERROR_IF_NOT_ZERO ( retVal );
         }
      }
   } else {
      unzFailsExist = True;
      deleteOutputOnInterrupt = False;
      if ( srcMode == SM_F2F ) {
         IntNative retVal = remove ( outName );
         ERROR_IF_NOT_ZERO ( retVal );
      }
   }
   deleteOutputOnInterrupt = False;

   if ( magicNumberOK ) {
      if (verbosity >= 1)
         fprintf ( stderr, "done\n" );
   } else {
      setExit(2);
      if (verbosity >= 1)
         fprintf ( stderr, "not a bzip2 file.\n" ); else
         fprintf ( stderr,
                   "%s: %s is not a bzip2 file.\n",
                   progName, inName );
   }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x27c8, %rsp           # imm = 0x27C8
movb $0x0, 0x14a27(%rip)     # 0x18de4
testq %rdi, %rdi
sete %cl
movl 0x15663(%rip), %eax     # 0x19a2c
cmpl $0x1, %eax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x4b72
movq %rdi, %r14
cmpl $0x3, %eax
je 0x4427
cmpl $0x2, %eax
je 0x4400
cmpl $0x1, %eax
jne 0x4488
leaq 0x149f9(%rip), %rdi     # 0x18df0
leaq 0xefec(%rip), %rsi      # 0x133ea
jmp 0x440a
leaq 0x149e9(%rip), %rdi     # 0x18df0
movq %r14, %rsi
callq 0x3a9d
leaq 0x14dea(%rip), %rdi     # 0x19200
leaq 0xefd5(%rip), %rsi      # 0x133f2
callq 0x3a9d
jmp 0x44bd
leaq 0x149c2(%rip), %rdi     # 0x18df0
movq %r14, %rsi
callq 0x3a9d
leaq 0x14dc3(%rip), %rbx     # 0x19200
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a9d
xorl %r15d, %r15d
leaq 0x13d1e(%rip), %r12     # 0x18170
movq (%r15,%r12), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x518e
testb %al, %al
jne 0x448c
addq $0x8, %r15
cmpq $0x20, %r15
jne 0x4452
movq %rbx, %rdi
callq 0x20e0
movl $0x74756f2e, (%rax,%rbx) # imm = 0x74756F2E
movb $0x0, 0x4(%rax,%rbx)
movb $0x1, %bpl
jmp 0x44bf
xorl %ebp, %ebp
jmp 0x44c5
leaq 0x13cfd(%rip), %rax     # 0x18190
movq (%r15,%rax), %r15
movq %rbx, %rdi
callq 0x20e0
movq %rax, %r12
movq %r14, %rdi
callq 0x20e0
subq %rax, %r12
movb $0x0, (%r12,%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2250
xorl %ebp, %ebp
movl 0x15567(%rip), %eax     # 0x19a2c
cmpl $0x1, %eax
je 0x455c
leaq 0x1491b(%rip), %rdi     # 0x18df0
callq 0x5169
testb %al, %al
je 0x4ade
movl 0x15544(%rip), %eax     # 0x19a2c
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x455c
leaq 0x148f9(%rip), %rdi     # 0x18df0
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x2190
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rbx), %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0x4b41
cmpl $0x3, 0x1550e(%rip)     # 0x19a2c
jne 0x455c
cmpb $0x0, 0x148a3(%rip)     # 0x18dca
jne 0x455c
leaq 0x148c0(%rip), %rdi     # 0x18df0
leaq 0xb0(%rsp), %rsi
callq 0x2140
testl %eax, %eax
jne 0x4a20
movl $0xf000, %eax           # imm = 0xF000
andl 0xc8(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x4a20
cmpb $0x0, 0x14868(%rip)     # 0x18dcb
setne %al
andb %al, %bpl
cmpb $0x1, %bpl
je 0x4a49
cmpl $0x3, 0x154b2(%rip)     # 0x19a2c
jne 0x45a5
leaq 0x14c7d(%rip), %rdi     # 0x19200
callq 0x5169
testb %al, %al
je 0x45a5
cmpb $0x0, 0x14837(%rip)     # 0x18dca
je 0x4b2a
leaq 0x14c60(%rip), %rdi     # 0x19200
callq 0x2080
movl 0x15481(%rip), %eax     # 0x19a2c
cmpl $0x3, %eax
jne 0x45ea
cmpb $0x0, 0x14813(%rip)     # 0x18dca
jne 0x45ea
leaq 0x14830(%rip), %rdi     # 0x18df0
leaq 0xb0(%rsp), %rbx
movq %rbx, %rsi
callq 0x2140
movl 0x10(%rbx), %ecx
decl %ecx
xorl %edi, %edi
testl %eax, %eax
cmovel %ecx, %edi
testl %edi, %edi
jg 0x4ae8
movl 0x15442(%rip), %eax     # 0x19a2c
cmpl $0x3, %eax
jne 0x45fa
callq 0x51d3
movl 0x15432(%rip), %eax     # 0x19a2c
cmpl $0x3, %eax
je 0x4669
cmpl $0x2, %eax
je 0x463e
cmpl $0x1, %eax
jne 0x4ba5
movq 0x139c4(%rip), %rax     # 0x17fd8
movq (%rax), %r14
movq 0x139b2(%rip), %rax     # 0x17fd0
movq (%rax), %rbx
movq %r14, %rdi
callq 0x21b0
movl %eax, %edi
callq 0x20b0
testl %eax, %eax
je 0x4699
callq 0x2b03
jmp 0x4967
leaq 0x147ab(%rip), %rdi     # 0x18df0
leaq 0xeee8(%rip), %rsi      # 0x13534
callq 0x2230
testq %rax, %rax
je 0x4b13
movq %rax, %r14
movq 0x1396c(%rip), %rax     # 0x17fd0
movq (%rax), %rbx
jmp 0x4699
leaq 0x14780(%rip), %rdi     # 0x18df0
leaq 0xeebd(%rip), %rsi      # 0x13534
callq 0x2230
movq %rax, %r14
callq 0x51f2
testq %rax, %rax
je 0x4b1d
movq %rax, %rbx
testq %r14, %r14
je 0x4b34
cmpl $0x0, 0x1472c(%rip)     # 0x18dcc
jg 0x4a53
movq %rbx, 0x14713(%rip)     # 0x18dc0
movb $0x1, 0x14730(%rip)     # 0x18de4
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
jne 0x48b9
movq %r14, %rdi
callq 0x20a0
testl %eax, %eax
jne 0x48b9
movl 0x146ea(%rip), %edx     # 0x18dcc
movzbl 0x146df(%rip), %ecx     # 0x18dc8
leaq 0x8(%rsp), %rdi
leaq 0x1440(%rsp), %r8
xorl %ebp, %ebp
movq %r14, %rsi
xorl %r9d, %r9d
callq 0x71bf
movq %rax, %r12
testq %rax, %rax
je 0x48be
cmpl $0x0, 0x8(%rsp)
jne 0x48be
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
leaq 0xb0(%rsp), %r13
incl %ebp
xorl %eax, %eax
testl %eax, %eax
jne 0x4785
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0x1388, %ecx           # imm = 0x1388
callq 0x73c0
movl 0x8(%rsp), %ecx
cmpl $-0x5, %ecx
je 0x4841
testl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
jne 0x476f
testl %eax, %eax
jle 0x476f
movl %eax, %edx
movl $0x1, %esi
movq %r13, %rdi
movq %rbx, %rcx
callq 0x2270
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
jne 0x48b9
movl 0x8(%rsp), %eax
jmp 0x472d
cmpl $0x4, %eax
jne 0x48be
movq %r15, %rdi
movq %r12, %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x75e7
cmpl $0x0, 0x8(%rsp)
jne 0x4b99
movslq 0xc(%rsp), %rax
testq %rax, %rax
jle 0x47d3
movq 0x10(%rsp), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
movb %sil, 0x1440(%rsp,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x47bf
movq %r15, %rdi
movq %r12, %rsi
callq 0x734f
cmpl $0x0, 0x8(%rsp)
jne 0x4b99
movl 0xc(%rsp), %r9d
testl %r9d, %r9d
jne 0x4808
movq %r14, %rdi
callq 0x530e
testb %al, %al
jne 0x4979
movl 0xc(%rsp), %r9d
movl 0x145be(%rip), %edx     # 0x18dcc
movzbl 0x145b3(%rip), %ecx     # 0x18dc8
movq %r15, %rdi
movq %r14, %rsi
leaq 0x1440(%rsp), %r8
callq 0x71bf
movq %rax, %r12
testq %rax, %rax
je 0x48be
cmpl $0x0, 0x8(%rsp)
je 0x4729
jmp 0x48be
cmpb $0x0, 0x14582(%rip)     # 0x18dca
je 0x48be
movq %r14, %rdi
callq 0x20f0
leaq 0xb0(%rsp), %r15
movq %r14, %rdi
callq 0x530e
testb %al, %al
jne 0x4979
movl $0x1, %esi
movl $0x1388, %edx           # imm = 0x1388
movq %r15, %rdi
movq %r14, %rcx
callq 0x20c0
movq %rax, %r12
movq %r14, %rdi
callq 0x20a0
testl %eax, %eax
jne 0x48b9
testl %r12d, %r12d
jle 0x48ad
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movl $0x1, %esi
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2270
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
je 0x485a
callq 0x52d3
leaq 0x1c(%rsp), %rdi
movq %r12, %rsi
callq 0x734f
movl 0x8(%rsp), %eax
cmpl $-0x5, %eax
jne 0x4b55
movq 0x136f9(%rip), %rax     # 0x17fd8
cmpq %r14, (%rax)
je 0x48ec
movq %r14, %rdi
callq 0x20d0
movq 0x136dd(%rip), %rax     # 0x17fd0
cmpq %rbx, (%rax)
je 0x4900
movq %rbx, %rdi
callq 0x20d0
cmpl $0x1, %ebp
je 0x4a67
cmpb $0x0, 0x144bb(%rip)     # 0x18dcb
jne 0x4ad4
movq $0x0, 0x1449f(%rip) # 0x18dc0
cmpl $0x3, 0x15104(%rip)     # 0x19a2c
jne 0x4953
callq 0x529b
movb $0x0, 0x144ae(%rip)     # 0x18de4
cmpb $0x0, 0x1448c(%rip)     # 0x18dc9
jne 0x4953
leaq 0x144aa(%rip), %rdi     # 0x18df0
callq 0x2080
testl %eax, %eax
jne 0x48b9
movb $0x0, 0x1448a(%rip)     # 0x18de4
cmpl $0x0, 0x1446b(%rip)     # 0x18dcc
jg 0x4a5d
addq $0x27c8, %rsp           # imm = 0x27C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x20a0
testl %eax, %eax
jne 0x48b9
movq 0x13640(%rip), %r15     # 0x17fd0
cmpq %rbx, (%r15)
je 0x49ac
movq %rbx, %rdi
callq 0x21b0
testl %eax, %eax
js 0x48b9
movl %eax, %edi
callq 0x532e
movq %r14, %rdi
callq 0x20d0
cmpl $-0x1, %eax
je 0x48b9
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
jne 0x48b9
movq %rbx, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x48b9
cmpq %rbx, (%r15)
je 0x49fe
movq %rbx, %rdi
callq 0x20d0
movq $0x0, 0x143cb(%rip) # 0x18dc0
cmpl $-0x1, %eax
je 0x48b9
movq $0x0, 0x143b7(%rip) # 0x18dc0
cmpl $0x2, 0x143bc(%rip)     # 0x18dcc
jl 0x4916
callq 0x2b82
jmp 0x4916
cmpb $0x0, 0x143a4(%rip)     # 0x18dcb
jne 0x4b4b
cmpl $0x0, 0x143b4(%rip)     # 0x18de8
jg 0x4967
movl $0x1, 0x143a4(%rip)     # 0x18de8
jmp 0x4967
callq 0x2910
jmp 0x4573
callq 0x2b54
jmp 0x46a6
callq 0x2bd0
jmp 0x4967
movq $0x0, 0x1434e(%rip) # 0x18dc0
movb $0x1, 0x1435c(%rip)     # 0x18dd5
movb $0x0, 0x14364(%rip)     # 0x18de4
cmpl $0x3, 0x14fa5(%rip)     # 0x19a2c
jne 0x4a9d
leaq 0x14770(%rip), %rdi     # 0x19200
callq 0x2080
testl %eax, %eax
jne 0x48b9
movb $0x0, 0x14340(%rip)     # 0x18de4
cmpl $0x1, 0x1433d(%rip)     # 0x18de8
jg 0x4ab7
movl $0x2, 0x14331(%rip)     # 0x18de8
cmpl $0x0, 0x1430e(%rip)     # 0x18dcc
movq 0x13533(%rip), %rax     # 0x17ff8
movq (%rax), %rdi
jle 0x4af2
callq 0x2bf2
jmp 0x4967
callq 0x2ba4
jmp 0x4916
callq 0x28b4
jmp 0x4967
callq 0x297e
jmp 0x4967
movq 0x14f27(%rip), %rdx     # 0x19a20
leaq 0xed11(%rip), %rsi      # 0x13811
leaq 0x142e9(%rip), %rcx     # 0x18df0
xorl %eax, %eax
callq 0x2180
jmp 0x4967
callq 0x2aa7
jmp 0x4967
movq %r14, %rdi
callq 0x2a3d
jmp 0x4967
callq 0x293d
jmp 0x4967
movq %rbx, %rdi
callq 0x29d8
jmp 0x4967
callq 0x2873
jmp 0x4967
callq 0x284d
jmp 0x4a2d
addl $0x9, %eax
cmpl $0x6, %eax
ja 0x4b8d
leaq 0xd524(%rip), %rcx      # 0x12088
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x53e0
leaq 0xebd7(%rip), %rdi      # 0x13750
callq 0x5137
callq 0x5454
callq 0x5108
callq 0x5420
leaq 0xece8(%rip), %rdi      # 0x1387c
callq 0x5137
leaq 0xec8e(%rip), %rdi      # 0x1382e
callq 0x5137
leaq 0xec47(%rip), %rdi      # 0x137f3
callq 0x5137