// File: /workspace/github_c_makefile_star2_O1/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, 0x109bb(%rip)     # 0x14de4
testq %rdi, %rdi
sete %cl
movl 0x115f7(%rip), %eax     # 0x15a2c
cmpl $0x1, %eax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x4bc0
movq %rdi, %r14
cmpl $0x3, %eax
je 0x4493
cmpl $0x2, %eax
je 0x446c
cmpl $0x1, %eax
jne 0x4525
leaq 0x1098d(%rip), %rdi     # 0x14df0
leaq 0xbf83(%rip), %rsi      # 0x103ed
jmp 0x4476
leaq 0x1097d(%rip), %rdi     # 0x14df0
movq %r14, %rsi
callq 0x3b15
leaq 0x10d7e(%rip), %rdi     # 0x15200
leaq 0xbf6c(%rip), %rsi      # 0x103f5
callq 0x3b15
jmp 0x4525
leaq 0x10956(%rip), %rdi     # 0x14df0
movq %r14, %rsi
callq 0x3b15
leaq 0x10d57(%rip), %rbx     # 0x15200
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b15
xorl %r15d, %r15d
leaq 0xfcb2(%rip), %r12      # 0x14170
movq (%r15,%r12), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x51f3
testb %al, %al
jne 0x44f4
addq $0x8, %r15
cmpq $0x20, %r15
jne 0x44be
movq %rbx, %rdi
callq 0x20f0
movl $0x74756f2e, (%rax,%rbx) # imm = 0x74756F2E
movb $0x0, 0x4(%rax,%rbx)
movb $0x1, %bpl
jmp 0x4527
leaq 0xfc95(%rip), %rax      # 0x14190
movq (%r15,%rax), %r15
movq %rbx, %rdi
callq 0x20f0
movq %rax, %r12
movq %r14, %rdi
callq 0x20f0
subq %rax, %r12
movb $0x0, (%r12,%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2250
xorl %ebp, %ebp
cmpl $0x1, 0x114fe(%rip)     # 0x15a2c
je 0x4544
leaq 0x108b9(%rip), %rdi     # 0x14df0
callq 0x51ce
testb %al, %al
je 0x4b2b
movl 0x114e2(%rip), %eax     # 0x15a2c
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x4579
leaq 0x10897(%rip), %rdi     # 0x14df0
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x2190
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rbx), %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0x4b32
cmpl $0x3, 0x114ac(%rip)     # 0x15a2c
jne 0x45be
cmpb $0x0, 0x10841(%rip)     # 0x14dca
jne 0x45be
leaq 0x1085e(%rip), %rdi     # 0x14df0
leaq 0xb0(%rsp), %rsi
callq 0x2150
testl %eax, %eax
jne 0x46ba
movl $0xf000, %eax           # imm = 0xF000
andl 0xc8(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x46ba
cmpb $0x0, 0x10806(%rip)     # 0x14dcb
setne %al
andb %al, %bpl
cmpb $0x1, %bpl
je 0x4ae3
cmpl $0x3, 0x11450(%rip)     # 0x15a2c
jne 0x4607
leaq 0x10c1b(%rip), %rdi     # 0x15200
callq 0x51ce
testb %al, %al
je 0x4607
cmpb $0x0, 0x107d5(%rip)     # 0x14dca
je 0x4b82
leaq 0x10bfe(%rip), %rdi     # 0x15200
callq 0x2080
cmpl $0x3, 0x1141e(%rip)     # 0x15a2c
jne 0x4644
cmpb $0x0, 0x107b3(%rip)     # 0x14dca
jne 0x4644
leaq 0x107d0(%rip), %rdi     # 0x14df0
leaq 0xb0(%rsp), %rbx
movq %rbx, %rsi
callq 0x2150
movl 0x10(%rbx), %ecx
decl %ecx
xorl %edi, %edi
testl %eax, %eax
cmovel %ecx, %edi
testl %edi, %edi
jg 0x4b39
cmpl $0x3, 0x113e1(%rip)     # 0x15a2c
jne 0x4668
leaq 0x1079c(%rip), %rdi     # 0x14df0
leaq 0x117f5(%rip), %rsi     # 0x15e50
callq 0x2190
testl %eax, %eax
jne 0x4958
movl 0x113be(%rip), %eax     # 0x15a2c
cmpl $0x3, %eax
je 0x470e
cmpl $0x2, %eax
je 0x46e3
cmpl $0x1, %eax
jne 0x4bf3
movq 0xf94c(%rip), %rax      # 0x13fd8
movq (%rax), %r14
movq 0xf93a(%rip), %rax      # 0x13fd0
movq (%rax), %rbx
movq %r14, %rdi
callq 0x21b0
movl %eax, %edi
callq 0x20c0
testl %eax, %eax
je 0x473e
callq 0x2aea
jmp 0x4ad1
cmpb $0x0, 0x1070a(%rip)     # 0x14dcb
jne 0x4b61
cmpl $0x0, 0x1071a(%rip)     # 0x14de8
jg 0x4ad1
movl $0x1, 0x1070a(%rip)     # 0x14de8
jmp 0x4ad1
leaq 0x10706(%rip), %rdi     # 0x14df0
leaq 0xbe46(%rip), %rsi      # 0x10537
callq 0x2230
testq %rax, %rax
je 0x4b6b
movq %rax, %r14
movq 0xf8c7(%rip), %rax      # 0x13fd0
movq (%rax), %rbx
jmp 0x473e
leaq 0x106db(%rip), %rdi     # 0x14df0
leaq 0xbe1b(%rip), %rsi      # 0x10537
callq 0x2230
movq %rax, %r14
callq 0x5238
testq %rax, %rax
je 0x4b75
movq %rax, %rbx
testq %r14, %r14
je 0x4b8c
cmpl $0x0, 0x10687(%rip)     # 0x14dcc
jg 0x4aed
movq %rbx, 0x1066e(%rip)     # 0x14dc0
movb $0x1, 0x1068b(%rip)     # 0x14de4
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
callq 0x20b0
testl %eax, %eax
jne 0x4958
movq %r14, %rdi
callq 0x20b0
testl %eax, %eax
jne 0x4958
movl 0x10645(%rip), %edx     # 0x14dcc
movzbl 0x1063a(%rip), %ecx     # 0x14dc8
leaq 0x8(%rsp), %rdi
leaq 0x1440(%rsp), %r8
xorl %ebp, %ebp
movq %r14, %rsi
xorl %r9d, %r9d
callq 0x718c
movq %rax, %r15
testq %rax, %rax
je 0x495d
cmpl $0x0, 0x8(%rsp)
jne 0x495d
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
leaq 0xb0(%rsp), %r13
incl %ebp
movl 0x8(%rsp), %eax
testl %eax, %eax
jne 0x4827
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl $0x1388, %ecx           # imm = 0x1388
callq 0x7388
movl 0x8(%rsp), %ecx
cmpl $-0x5, %ecx
je 0x48e0
testl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
jne 0x4816
testl %eax, %eax
jle 0x4816
movl %eax, %edx
movl $0x1, %esi
movq %r13, %rdi
movq %rbx, %rcx
callq 0x2270
movq %rbx, %rdi
callq 0x20b0
testl %eax, %eax
je 0x47d0
jmp 0x4958
cmpl $0x4, %eax
jne 0x495d
movq %r12, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x75ab
cmpl $0x0, 0x8(%rsp)
jne 0x4be7
movslq 0xc(%rsp), %rax
testq %rax, %rax
jle 0x4875
movq 0x10(%rsp), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
movb %sil, 0x1440(%rsp,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x4861
movq %r12, %rdi
movq %r15, %rsi
callq 0x731f
cmpl $0x0, 0x8(%rsp)
jne 0x4be7
cmpl $0x0, 0xc(%rsp)
jne 0x48a2
movq %r14, %rdi
callq 0x5368
testb %al, %al
jne 0x49c1
movl 0x10524(%rip), %edx     # 0x14dcc
movzbl 0x10519(%rip), %ecx     # 0x14dc8
movl 0xc(%rsp), %r9d
movq %r12, %rdi
movq %r14, %rsi
leaq 0x1440(%rsp), %r8
callq 0x718c
movq %rax, %r15
testq %rax, %rax
je 0x495d
cmpl $0x0, 0x8(%rsp)
je 0x47ce
jmp 0x495d
cmpb $0x0, 0x104e3(%rip)     # 0x14dca
je 0x495d
movq %r14, %rdi
callq 0x2100
leaq 0xb0(%rsp), %r15
movq %r14, %rdi
callq 0x5368
testb %al, %al
jne 0x49c1
movl $0x1, %esi
movl $0x1388, %edx           # imm = 0x1388
movq %r15, %rdi
movq %r14, %rcx
callq 0x20d0
movq %rax, %r12
movq %r14, %rdi
callq 0x20b0
testl %eax, %eax
jne 0x4958
testl %r12d, %r12d
jle 0x494c
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movl $0x1, %esi
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2270
movq %rbx, %rdi
callq 0x20b0
testl %eax, %eax
je 0x48f9
callq 0x532d
leaq 0x1c(%rsp), %rdi
movq %r15, %rsi
callq 0x731f
movl 0x8(%rsp), %eax
cmpl $-0x5, %eax
jne 0x4ba3
movq 0xf65a(%rip), %rax      # 0x13fd8
cmpq %r14, (%rax)
je 0x498b
movq %r14, %rdi
callq 0x20e0
movq 0xf63e(%rip), %rax      # 0x13fd0
cmpq %rbx, (%rax)
je 0x499f
movq %rbx, %rdi
callq 0x20e0
movb $0x1, %bl
cmpl $0x1, %ebp
je 0x4a5c
cmpb $0x0, 0x1041a(%rip)     # 0x14dcb
je 0x4a5a
callq 0x2b8b
jmp 0x4a5a
movq %r14, %rdi
callq 0x20b0
testl %eax, %eax
jne 0x4958
movq 0xf5fc(%rip), %r15      # 0x13fd0
cmpq %rbx, (%r15)
je 0x49f0
movq %rbx, %rdi
callq 0x21b0
testl %eax, %eax
js 0x4958
movl %eax, %edi
callq 0x5388
movq %r14, %rdi
callq 0x20e0
cmpl $-0x1, %eax
je 0x4958
movq %rbx, %rdi
callq 0x20b0
testl %eax, %eax
jne 0x4958
movq %rbx, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x4958
cmpq %rbx, (%r15)
je 0x4a42
movq %rbx, %rdi
callq 0x20e0
movq $0x0, 0x10387(%rip) # 0x14dc0
cmpl $-0x1, %eax
je 0x4958
movq $0x0, 0x10373(%rip) # 0x14dc0
cmpl $0x2, 0x10378(%rip)     # 0x14dcc
jge 0x4b99
xorl %ebx, %ebx
movq $0x0, 0x10359(%rip) # 0x14dc0
testb %bl, %bl
je 0x4a8b
movb $0x1, 0x10363(%rip)     # 0x14dd5
movb $0x0, 0x1036b(%rip)     # 0x14de4
cmpl $0x3, 0x10fac(%rip)     # 0x15a2c
jne 0x4abd
leaq 0x10777(%rip), %rdi     # 0x15200
jmp 0x4ab0
cmpl $0x3, 0x10f9a(%rip)     # 0x15a2c
jne 0x4abd
callq 0x52f5
movb $0x0, 0x10344(%rip)     # 0x14de4
cmpb $0x0, 0x10322(%rip)     # 0x14dc9
jne 0x4abd
leaq 0x10340(%rip), %rdi     # 0x14df0
callq 0x2080
testl %eax, %eax
jne 0x4958
movb $0x0, 0x10320(%rip)     # 0x14de4
testb %bl, %bl
jne 0x4af7
cmpl $0x0, 0x102fd(%rip)     # 0x14dcc
jg 0x4b24
addq $0x27c8, %rsp           # imm = 0x27C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x28f7
jmp 0x45d5
callq 0x2b3b
jmp 0x474b
cmpl $0x1, 0x102ea(%rip)     # 0x14de8
jg 0x4b0a
movl $0x2, 0x102de(%rip)     # 0x14de8
cmpl $0x0, 0x102bb(%rip)     # 0x14dcc
movq 0xf4e0(%rip), %rax      # 0x13ff8
movq (%rax), %rdi
jle 0x4b40
callq 0x2bd9
jmp 0x4ad1
callq 0x2bb7
jmp 0x4ad1
callq 0x2875
jmp 0x4ad1
callq 0x2bf4
jmp 0x4ad1
callq 0x2965
jmp 0x4ad1
movq 0x10ed9(%rip), %rdx     # 0x15a20
leaq 0xbcc6(%rip), %rsi      # 0x10814
leaq 0x1029b(%rip), %rcx     # 0x14df0
xorl %eax, %eax
callq 0x2180
jmp 0x4ad1
callq 0x28d1
jmp 0x46c7
callq 0x2a8e
jmp 0x4ad1
movq %r14, %rdi
callq 0x2a24
jmp 0x4ad1
callq 0x2924
jmp 0x4ad1
movq %rbx, %rdi
callq 0x29bf
jmp 0x4ad1
callq 0x2b69
jmp 0x4a5a
addl $0x9, %eax
cmpl $0x6, %eax
ja 0x4bdb
leaq 0xa4d6(%rip), %rcx      # 0xf088
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x5442
leaq 0xbb8c(%rip), %rdi      # 0x10753
callq 0x519c
callq 0x54b5
callq 0x516d
callq 0x5481
leaq 0xbc9d(%rip), %rdi      # 0x1087f
callq 0x519c
leaq 0xbc43(%rip), %rdi      # 0x10831
callq 0x519c
leaq 0xbbfc(%rip), %rdi      # 0x107f6
callq 0x519c