// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/bzip2-1.0.6/bzlib.c
// Function: handle_compress
static
Bool handle_compress ( bz_stream* strm )
{
   Bool progress_in  = False;
   Bool progress_out = False;
   EState* s = strm->state;
   
   while (True) {

      if (s->state == BZ_S_OUTPUT) {
         progress_out |= copy_output_until_stop ( s );
         if (s->state_out_pos < s->numZ) break;
         if (s->mode == BZ_M_FINISHING && 
             s->avail_in_expect == 0 &&
             isempty_RL(s)) break;
         prepare_new_block ( s );
         s->state = BZ_S_INPUT;
         if (s->mode == BZ_M_FLUSHING && 
             s->avail_in_expect == 0 &&
             isempty_RL(s)) break;
      }

      if (s->state == BZ_S_INPUT) {
         progress_in |= copy_input_until_stop ( s );
         if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
            flush_RL ( s );
            BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) );
            s->state = BZ_S_OUTPUT;
         }
         else
         if (s->nblock >= s->nblockMAX) {
            BZ2_compressBlock ( s, False );
            s->state = BZ_S_OUTPUT;
         }
         else
         if (s->strm->avail_in == 0) {
            break;
         }
      }

   }

   return progress_in || progress_out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x30(%rdi), %rbx
xorl %r15d, %r15d
movq 0x68a73(%rip), %xmm1    # 0xe0a00
leaq 0xb6bac(%rip), %r14     # 0x12eb40
xorl %ebp, %ebp
movl 0xc(%rbx), %eax
cmpl $0x2, %eax
je 0x7805c
cmpl $0x1, %eax
jne 0x77f99
movq (%rbx), %rcx
movl 0x20(%rcx), %edx
movl 0x78(%rbx), %eax
xorl %r12d, %r12d
movl 0x74(%rbx), %esi
testl %edx, %edx
je 0x77ff1
cmpl %esi, %eax
jge 0x77ff1
movq 0x50(%rbx), %rdx
cltq
movb (%rdx,%rax), %al
movq 0x18(%rcx), %rcx
movb %al, (%rcx)
movl 0x78(%rbx), %eax
incl %eax
movl %eax, 0x78(%rbx)
movq (%rbx), %rcx
movl 0x20(%rcx), %edx
decl %edx
movl %edx, 0x20(%rcx)
incq 0x18(%rcx)
movb $0x1, %r12b
incl 0x24(%rcx)
jne 0x77fb3
incl 0x28(%rcx)
jmp 0x77fb3
orb %r15b, %r12b
cmpl %esi, %eax
jl 0x78283
cmpl $0x4, 0x8(%rbx)
jne 0x7801f
cmpl $0x0, 0x10(%rbx)
jne 0x7801f
cmpl $0xff, 0x5c(%rbx)
ja 0x78283
cmpl $0x0, 0x60(%rbx)
jle 0x78283
movq %rbx, %rdi
callq 0x77dfa
movl $0x2, 0xc(%rbx)
movl 0x8(%rbx), %eax
cmpl $0x3, %eax
jne 0x78067
cmpl $0x0, 0x10(%rbx)
movq 0x689be(%rip), %xmm1    # 0xe0a00
jne 0x7805f
cmpl $0xff, 0x5c(%rbx)
ja 0x78283
cmpl $0x0, 0x60(%rbx)
jg 0x7805f
jmp 0x78283
movl %r15d, %r12d
movl 0x8(%rbx), %eax
movl %r12d, %r15d
jmp 0x78072
movl %r12d, %r15d
movq 0x6898e(%rip), %xmm1    # 0xe0a00
xorl %ecx, %ecx
cmpl $0x2, %eax
jne 0x78147
movl 0x6c(%rbx), %eax
movl 0x70(%rbx), %edx
cmpl %edx, %eax
jge 0x7821a
movq (%rbx), %rsi
cmpl $0x0, 0x8(%rsi)
je 0x7821a
movq (%rsi), %rcx
movzbl (%rcx), %r12d
movl 0x5c(%rbx), %ecx
movl 0x60(%rbx), %edx
cmpl %r12d, %ecx
jne 0x780b9
cmpl $0xff, %edx
je 0x780fd
incl %edx
movl %edx, 0x60(%rbx)
jmp 0x78118
cmpl $0x1, %edx
jne 0x780f5
cltq
movl 0x288(%rbx), %edx
movl %edx, %esi
shll $0x8, %esi
shrl $0x18, %edx
movzbl %cl, %edi
xorl %edx, %edi
xorl (%r14,%rdi,4), %esi
movl %esi, 0x288(%rbx)
movb $0x1, 0x80(%rbx,%rcx)
movq 0x40(%rbx), %rdx
movb %cl, (%rdx,%rax)
incl 0x6c(%rbx)
movl %r12d, 0x5c(%rbx)
jmp 0x78118
cmpl $0xff, %ecx
ja 0x7810d
movq %rbx, %rdi
callq 0x79f43
movq 0x688f3(%rip), %xmm1    # 0xe0a00
movl %r12d, 0x5c(%rbx)
movl $0x1, 0x60(%rbx)
movq (%rbx), %rax
incq (%rax)
movq 0x8(%rax), %xmm0
paddd %xmm1, %xmm0
movq %xmm0, 0x8(%rax)
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %edx
movb $0x1, %cl
testl %edx, %edx
jne 0x7807d
incl 0x10(%rax)
jmp 0x7807d
movl 0x6c(%rbx), %eax
movl 0x70(%rbx), %edx
cmpl %edx, %eax
jge 0x7821a
movq (%rbx), %rsi
cmpl $0x0, 0x8(%rsi)
je 0x7821a
cmpl $0x0, 0x10(%rbx)
je 0x7821a
movq (%rsi), %rcx
movzbl (%rcx), %r12d
movl 0x5c(%rbx), %ecx
movl 0x60(%rbx), %edx
cmpl %r12d, %ecx
jne 0x7818d
cmpl $0xff, %edx
je 0x781d1
incl %edx
movl %edx, 0x60(%rbx)
jmp 0x781ec
cmpl $0x1, %edx
jne 0x781c9
cltq
movl 0x288(%rbx), %edx
movl %edx, %esi
shll $0x8, %esi
shrl $0x18, %edx
movzbl %cl, %edi
xorl %edx, %edi
xorl (%r14,%rdi,4), %esi
movl %esi, 0x288(%rbx)
movb $0x1, 0x80(%rbx,%rcx)
movq 0x40(%rbx), %rdx
movb %cl, (%rdx,%rax)
incl 0x6c(%rbx)
movl %r12d, 0x5c(%rbx)
jmp 0x781ec
cmpl $0xff, %ecx
ja 0x781e1
movq %rbx, %rdi
callq 0x79f43
movq 0x6881f(%rip), %xmm1    # 0xe0a00
movl %r12d, 0x5c(%rbx)
movl $0x1, 0x60(%rbx)
movq (%rbx), %rax
incq (%rax)
movq 0x8(%rax), %xmm0
paddd %xmm1, %xmm0
movq %xmm0, 0x8(%rax)
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %ecx
testl %ecx, %ecx
jne 0x78210
incl 0x10(%rax)
decl 0x10(%rbx)
movb $0x1, %cl
jmp 0x78147
orb %cl, %bpl
movl 0x8(%rbx), %ecx
cmpl $0x2, %ecx
je 0x7822b
cmpl $0x0, 0x10(%rbx)
je 0x78242
cmpl %edx, %eax
jge 0x7823e
movq (%rbx), %rax
cmpl $0x0, 0x8(%rax)
jne 0x77f96
jmp 0x78286
xorl %eax, %eax
jmp 0x78264
cmpl $0xff, 0x5c(%rbx)
ja 0x78256
movq %rbx, %rdi
callq 0x79f43
movl 0x8(%rbx), %ecx
movq $0x100, 0x5c(%rbx)      # imm = 0x100
cmpl $0x4, %ecx
sete %al
movzbl %al, %esi
movq %rbx, %rdi
callq 0x95b65
movl $0x1, 0xc(%rbx)
movq 0x68782(%rip), %xmm1    # 0xe0a00
jmp 0x77f96
movl %r12d, %r15d
orb %bpl, %r15b
setne %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq