LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngrtran.c
// Function: png_set_gamma
void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
{
   png_debug(1, "in png_set_gamma");

   if (png_ptr == NULL)
      return;

   if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
       (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
       (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
     png_ptr->transformations |= PNG_GAMMA;
   png_ptr->gamma = (float)file_gamma;
   png_ptr->screen_gamma = (float)scrn_gamma;
}

// Assembly:
testq %rdi, %rdi
je 0x8e155
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
addsd 0x13f30(%rip), %xmm2    # 0xa2048
andpd 0x14150(%rip), %xmm2    # 0xa2270
ucomisd 0x1ece8(%rip), %xmm2    # 0xace10
ja 0x8e13e
movb 0x24e(%rdi), %al
testb $0x4, %al
sete %cl
cmpb $0x3, %al
setne %al
testb %cl, %al
jne 0x8e145
orb $0x20, 0x125(%rdi)
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
cvtpd2ps %xmm1, %xmm0
movlpd %xmm0, 0x28c(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngrtran.c
// Function: png_set_rgb_to_gray
void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
   double green)
{
   int red_fixed = (int)((float)red*100000.0 + 0.5);
   int green_fixed = (int)((float)green*100000.0 + 0.5);
   if (png_ptr == NULL)
      return;
   png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
}

// Assembly:
testq %rdi, %rdi
je 0x8e1fb
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x1e32a(%rip), %xmm2    # 0xac4f8
mulsd %xmm2, %xmm1
movsd 0x13e56(%rip), %xmm3    # 0xa2030
addsd %xmm3, %xmm1
cvttsd2si %xmm1, %ecx
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
cvttsd2si %xmm0, %edx
jmp 0x8e1fc
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngwtran.c
// Function: png_do_write_intrapixel
void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{
   png_debug(1, "in png_do_write_intrapixel");

   if (
       (row_info->color_type & PNG_COLOR_MASK_COLOR))
   {
      int bytes_per_pixel;
      png_uint_32 row_width = row_info->width;
      if (row_info->bit_depth == 8)
      {
         png_bytep rp;
         png_uint_32 i;

         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
            bytes_per_pixel = 3;
         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
            bytes_per_pixel = 4;
         else
            return;

         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
         {
            *(rp)   = (png_byte)((*rp     - *(rp+1))&0xff);
            *(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
         }
      }
      else if (row_info->bit_depth == 16)
      {
         png_bytep rp;
         png_uint_32 i;

         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
            bytes_per_pixel = 6;
         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
            bytes_per_pixel = 8;
         else
            return;

         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
         {
            png_uint_32 s0   = (*(rp  ) << 8) | *(rp+1);
            png_uint_32 s1   = (*(rp+2) << 8) | *(rp+3);
            png_uint_32 s2   = (*(rp+4) << 8) | *(rp+5);
            png_uint_32 red  = (png_uint_32)((s0 - s1) & 0xffffL);
            png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
            *(rp  ) = (png_byte)((red >> 8) & 0xff);
            *(rp+1) = (png_byte)(red & 0xff);
            *(rp+4) = (png_byte)((blue >> 8) & 0xff);
            *(rp+5) = (png_byte)(blue & 0xff);
         }
      }
   }
}

// Assembly:
pushq %rbx
movzbl 0x10(%rdi), %ecx
testb $0x2, %cl
je 0x92b9a
movl (%rdi), %eax
movzbl 0x11(%rdi), %edx
cmpl $0x10, %edx
je 0x92b24
cmpl $0x8, %edx
jne 0x92b9a
cmpl $0x2, %ecx
je 0x92b35
cmpl $0x6, %ecx
jne 0x92b9a
movl $0x4, %ecx
jmp 0x92b3a
cmpl $0x2, %ecx
je 0x92b53
cmpl $0x6, %ecx
jne 0x92b9a
movl $0x8, %ecx
jmp 0x92b58
movl $0x3, %ecx
testl %eax, %eax
je 0x92b9a
addq $0x2, %rsi
movb -0x1(%rsi), %dl
subb %dl, -0x2(%rsi)
subb %dl, (%rsi)
addq %rcx, %rsi
decl %eax
jne 0x92b42
jmp 0x92b9a
movl $0x6, %ecx
testl %eax, %eax
je 0x92b9a
addq $0x5, %rsi
movzwl -0x5(%rsi), %edx
movzwl -0x3(%rsi), %edi
rolw $0x8, %dx
movzwl %dx, %edx
rolw $0x8, %di
movzwl %di, %edi
movzwl -0x1(%rsi), %r8d
rolw $0x8, %r8w
movzwl %r8w, %ebx
subl %edi, %edx
subl %edi, %ebx
movb %dh, -0x5(%rsi)
movb %dl, -0x4(%rsi)
movb %bh, -0x1(%rsi)
movb %bl, (%rsi)
addq %rcx, %rsi
decl %eax
jne 0x92b60
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngmem.c
// Function: png_create_struct_2
png_voidp /* PRIVATE */
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
   png_size_t size;
   png_voidp struct_ptr;

   if (type == PNG_STRUCT_INFO)
      size = png_sizeof(png_info);
   else if (type == PNG_STRUCT_PNG)
      size = png_sizeof(png_struct);
   else
      return (NULL);

#ifdef PNG_USER_MEM_SUPPORTED
   if (malloc_fn != NULL)
   {
      png_struct dummy_struct;
      png_structp png_ptr = &dummy_struct;
      png_ptr->mem_ptr=mem_ptr;
      struct_ptr = (*(malloc_fn))(png_ptr, size);
      if (struct_ptr != NULL)
         png_memset(struct_ptr, 0, size);
      return (struct_ptr);
   }
#endif /* PNG_USER_MEM_SUPPORTED */

#if defined(__TURBOC__) && !defined(__FLAT__)
   struct_ptr = (png_voidp)farmalloc(size);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
   struct_ptr = (png_voidp)halloc(size, 1);
# else
   struct_ptr = (png_voidp)malloc(size);
# endif
#endif
   if (struct_ptr != NULL)
      png_memset(struct_ptr, 0, size);

   return (struct_ptr);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rsi, %rax
cmpl $0x2, %edi
je 0x92bf0
cmpl $0x1, %edi
jne 0x92c20
movl $0x498, %ebx            # imm = 0x498
jmp 0x92bf5
movl $0x170, %ebx            # imm = 0x170
testq %rax, %rax
je 0x92c25
movq %rsp, %rdi
movq %rdx, 0x418(%rdi)
movq %rbx, %rsi
callq *%rax
movq %rax, %r14
testq %rax, %rax
je 0x92c4c
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0xe260
jmp 0x92c4c
xorl %r14d, %r14d
jmp 0x92c4c
movq %rbx, %rdi
callq 0xe5e0
movq %rax, %r14
testq %rax, %rax
je 0x92c4c
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r14
jmp 0xe260
movq %r14, %rax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngmem.c
// Function: png_calloc
png_voidp PNGAPI
png_calloc(png_structp png_ptr, png_alloc_size_t size)
{
   png_voidp ret;

   ret = (png_malloc(png_ptr, size));
   if (ret != NULL)
      png_memset(ret,0,(png_size_t)size);
   return (ret);
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
callq 0x92cb5
testq %rax, %rax
je 0x92cb3
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
jmp 0xe260
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngmem.c
// Function: png_malloc_warn
png_voidp PNGAPI
png_malloc_warn(png_structp png_ptr, png_alloc_size_t size)
{
   png_voidp ptr;
   png_uint_32 save_flags;
   if (png_ptr == NULL)
      return (NULL);

   save_flags = png_ptr->flags;
   png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
   ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
   png_ptr->flags=save_flags;
   return(ptr);
}

// Assembly:
testq %rdi, %rdi
je 0x92da2
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x120(%rdi), %ebp
movl %ebp, %eax
orl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x120(%rdi)
callq 0x92cb5
movl %ebp, 0x120(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngerror.c
// Function: png_warning
void PNGAPI
png_warning(png_structp png_ptr, png_const_charp warning_message)
{
   int offset = 0;
   if (png_ptr != NULL)
   {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
   if (png_ptr->flags&
     (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif
     {
       if (*warning_message == PNG_LITERAL_SHARP)
       {
           for (offset = 1; offset < 15; offset++)
              if (warning_message[offset] == ' ')
                  break;
       }
     }
   }
   if (png_ptr != NULL && png_ptr->warning_fn != NULL)
      (*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
   else
      png_default_warning(png_ptr, warning_message + offset);
}

// Assembly:
testq %rdi, %rdi
je 0x92e95
cmpb $0x23, (%rsi)
jne 0x92e95
movl $0x1, %eax
cmpb $0x20, (%rsi,%rax)
je 0x92e91
incq %rax
cmpq $0xf, %rax
jne 0x92e7d
movl $0xf, %eax
movl %eax, %eax
jmp 0x92e97
xorl %eax, %eax
testq %rdi, %rdi
je 0x92ead
movq 0xd8(%rdi), %rcx
testq %rcx, %rcx
je 0x92ead
addq %rax, %rsi
jmpq *%rcx
pushq %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0xee2c
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngerror.c
// Function: png_chunk_error
void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{
   char msg[18+PNG_MAX_ERROR_TEXT];
   if (png_ptr == NULL)
     png_error(png_ptr, error_message);
   else
   {
     png_format_buffer(png_ptr, msg, error_message);
     png_error(png_ptr, msg);
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rdx
testq %rdi, %rdi
jne 0x92ed4
xorl %edi, %edi
movq %rdx, %rsi
callq 0x92dd0
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rsi
callq 0x92eed
movq %rbx, %rdi
movq %r14, %rsi
callq 0x92dd0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngerror.c
// Function: png_format_buffer
static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
   error_message)
{
   int iout = 0, iin = 0;

   while (iin < 4)
   {
      int c = png_ptr->chunk_name[iin++];
      if (isnonalpha(c))
      {
         buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
         buffer[iout++] = png_digit[(c & 0xf0) >> 4];
         buffer[iout++] = png_digit[c & 0x0f];
         buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
      }
      else
      {
         buffer[iout++] = (png_byte)c;
      }
   }

   if (error_message == NULL)
      buffer[iout] = '\0';
   else
   {
      buffer[iout++] = ':';
      buffer[iout++] = ' ';
      png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
      buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
   }
}

// Assembly:
xorl %eax, %eax
leaq 0x1a08a(%rip), %rcx     # 0xacf80
xorl %r8d, %r8d
movb 0x244(%rdi,%rax), %r10b
leal -0x7b(%r10), %r9d
cmpb $-0x3a, %r9b
setb %r9b
leal -0x5b(%r10), %r11d
cmpb $0x6, %r11b
setb %r11b
orb %r9b, %r11b
movslq %r8d, %r9
cmpb $0x1, %r11b
jne 0x92f57
movzbl %r10b, %r8d
movb $0x5b, (%rsi,%r9)
movl %r8d, %r10d
shrl $0x4, %r10d
movb (%r10,%rcx), %r10b
movb %r10b, 0x1(%rsi,%r9)
andl $0xf, %r8d
movb (%r8,%rcx), %r8b
movb %r8b, 0x2(%rsi,%r9)
leal 0x4(%r9), %r8d
movb $0x5d, 0x3(%rsi,%r9)
jmp 0x92f5f
leal 0x1(%r9), %r8d
movb %r10b, (%rsi,%r9)
incq %rax
cmpq $0x4, %rax
jne 0x92ef9
movslq %r8d, %rcx
leaq (%rsi,%rcx), %rax
testq %rdx, %rdx
je 0x92fa0
movw $0x203a, (%rax)         # imm = 0x203A
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups 0x30(%rdx), %xmm3
movups %xmm3, 0x32(%rsi,%rcx)
movups %xmm2, 0x22(%rsi,%rcx)
movups %xmm1, 0x12(%rsi,%rcx)
movups %xmm0, 0x2(%rsi,%rcx)
addq $0x41, %rax
movb $0x0, (%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngerror.c
// Function: png_chunk_warning
void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{
   char msg[18+PNG_MAX_ERROR_TEXT];
   if (png_ptr == NULL)
     png_warning(png_ptr, warning_message);
   else
   {
     png_format_buffer(png_ptr, msg, warning_message);
     png_warning(png_ptr, msg);
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rdx
testq %rdi, %rdi
je 0x92fd4
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rsi
callq 0x92eed
movq %rbx, %rdi
movq %r14, %rsi
callq 0x92e6e
addq $0x58, %rsp
popq %rbx
popq %r14
retq
movq %rdx, %rdi
callq 0xee55
jmp 0x92fcc
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: deflateEnd
int ZEXPORT deflateEnd (strm)
    z_streamp strm;
{
    int status;

    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;

    status = strm->state->status;
    if (status != INIT_STATE &&
        status != EXTRA_STATE &&
        status != NAME_STATE &&
        status != COMMENT_STATE &&
        status != HCRC_STATE &&
        status != BUSY_STATE &&
        status != FINISH_STATE) {
      return Z_STREAM_ERROR;
    }

    /* Deallocate in reverse order of allocations: */
    TRY_FREE(strm, strm->state->pending_buf);
    TRY_FREE(strm, strm->state->head);
    TRY_FREE(strm, strm->state->prev);
    TRY_FREE(strm, strm->state->window);

    ZFREE(strm, strm->state);
    strm->state = Z_NULL;

    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
}

// Assembly:
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x93874
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rcx
testq %rcx, %rcx
je 0x9386d
movl 0x8(%rcx), %r14d
leal -0x45(%r14), %edx
cmpl $0x2c, %edx
ja 0x93875
movabsq $0x100400400011, %rsi   # imm = 0x100400400011
btq %rdx, %rsi
jae 0x93875
movq 0x10(%rcx), %rsi
testq %rsi, %rsi
je 0x9380f
movq 0x50(%rbx), %rdi
callq *0x48(%rbx)
movq 0x38(%rbx), %rax
movq 0x68(%rax), %rsi
testq %rsi, %rsi
je 0x93823
movq 0x50(%rbx), %rdi
callq *0x48(%rbx)
movq 0x38(%rbx), %rax
movq 0x60(%rax), %rsi
testq %rsi, %rsi
je 0x93837
movq 0x50(%rbx), %rdi
callq *0x48(%rbx)
movq 0x38(%rbx), %rax
movq 0x50(%rax), %rsi
testq %rsi, %rsi
je 0x9384b
movq 0x50(%rbx), %rdi
callq *0x48(%rbx)
movq 0x38(%rbx), %rsi
movq 0x50(%rbx), %rdi
callq *0x48(%rbx)
movq $0x0, 0x38(%rbx)
xorl %eax, %eax
cmpl $0x71, %r14d
setne %al
leal (%rax,%rax,2), %eax
addl $-0x3, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x29a, %r14d           # imm = 0x29A
je 0x937ff
cmpl $0x2a, %r14d
je 0x937ff
jmp 0x9386d
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: deflateReset
int ZEXPORT deflateReset (strm)
    z_streamp strm;
{
    deflate_state *s;

    if (strm == Z_NULL || strm->state == Z_NULL ||
        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
        return Z_STREAM_ERROR;
    }

    strm->total_in = strm->total_out = 0;
    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
    strm->data_type = Z_UNKNOWN;

    s = (deflate_state *)strm->state;
    s->pending = 0;
    s->pending_out = s->pending_buf;

    if (s->wrap < 0) {
        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
    }
    s->status = s->wrap ? INIT_STATE : BUSY_STATE;
    strm->adler =
#ifdef GZIP
        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
#endif
        adler32(0L, Z_NULL, 0);
    s->last_flush = Z_NO_FLUSH;

    _tr_init(s);
    lm_init(s);

    return Z_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x939c3
movq %rdi, %r15
movq 0x38(%rdi), %rbx
testq %rbx, %rbx
je 0x939c3
cmpq $0x0, 0x40(%r15)
je 0x939c3
cmpq $0x0, 0x48(%r15)
je 0x939c3
movq $0x0, 0x10(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r15)
movl $0x2, 0x58(%r15)
movl $0x0, 0x28(%rbx)
movq 0x10(%rbx), %rax
movq %rax, 0x20(%rbx)
movl 0x2c(%rbx), %eax
testl %eax, %eax
jns 0x938f7
negl %eax
movl %eax, 0x2c(%rbx)
movl 0x2c(%rbx), %eax
testl %eax, %eax
movl $0x71, %ecx
movl $0x2a, %edx
cmovel %ecx, %edx
movl %edx, 0x8(%rbx)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
cmpl $0x2, %eax
jne 0x9391e
callq 0x93034
jmp 0x93923
callq 0xa1570
movq %rax, 0x60(%r15)
xorl %r14d, %r14d
movl %r14d, 0x40(%rbx)
movq %rbx, %rdi
callq 0x98040
movl 0x44(%rbx), %eax
addq %rax, %rax
movq %rax, 0x58(%rbx)
movq 0x68(%rbx), %rdi
movl 0x74(%rbx), %edx
decl %edx
movw $0x0, (%rdi,%rdx,2)
addq %rdx, %rdx
xorl %esi, %esi
callq 0xe260
movslq 0xb4(%rbx), %rax
shlq $0x4, %rax
leaq 0x512c5(%rip), %rcx     # 0xe4c30
movzwl 0x2(%rax,%rcx), %edx
movl %edx, 0xb0(%rbx)
movzwl (%rax,%rcx), %edx
movl %edx, 0xbc(%rbx)
movzwl 0x4(%rax,%rcx), %edx
movl %edx, 0xc0(%rbx)
movzwl 0x6(%rax,%rcx), %eax
movl %eax, 0xac(%rbx)
movq %r14, 0x88(%rbx)
movabsq $0x200000000, %rax      # imm = 0x200000000
movq %rax, 0xa4(%rbx)
movl $0x2, 0x90(%rbx)
movq %r14, 0x98(%rbx)
movl %r14d, 0x70(%rbx)
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: deflateSetDictionary
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
    z_streamp strm;
    const Bytef *dictionary;
    uInt  dictLength;
{
    deflate_state *s;
    uInt length = dictLength;
    uInt n;
    IPos hash_head = 0;

    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
        strm->state->wrap == 2 ||
        (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
        return Z_STREAM_ERROR;

    s = strm->state;
    if (s->wrap)
        strm->adler = adler32(strm->adler, dictionary, dictLength);

    if (length < MIN_MATCH) return Z_OK;
    if (length > s->w_size) {
        length = s->w_size;
        dictionary += dictLength - length; /* use the tail of the dictionary */
    }
    zmemcpy(s->window, dictionary, length);
    s->strstart = length;
    s->block_start = (long)length;

    /* Insert all strings in the hash table (except for the last two bytes).
     * s->lookahead stays null, so s->ins_h will be recomputed at the next
     * call of fill_window.
     */
    s->ins_h = s->window[0];
    UPDATE_HASH(s, s->ins_h, s->window[1]);
    for (n = 0; n <= length - MIN_MATCH; n++) {
        INSERT_STRING(s, n, hash_head);
    }
    if (hash_head) hash_head = 0;  /* to make compiler happy */
    return Z_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x93af4
movq %rsi, %r15
movq %rdi, %r12
movq 0x38(%rdi), %r13
testq %r13, %r13
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x93af4
movl %edx, %ebx
movl 0x2c(%r13), %eax
testl %eax, %eax
je 0x93a3d
cmpl $0x2, %eax
je 0x93af4
cmpl $0x1, %eax
jne 0x93a29
cmpl $0x2a, 0x8(%r13)
jne 0x93af4
testl %eax, %eax
je 0x93a3d
movq 0x60(%r12), %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0xa1570
movq %rax, 0x60(%r12)
xorl %r14d, %r14d
cmpl $0x3, %ebx
jb 0x93af4
movl 0x44(%r13), %eax
xorl %r14d, %r14d
movl %ebx, %ecx
subl %eax, %ecx
cmovbl %r14d, %ecx
addq %rcx, %r15
cmpl %ebx, %eax
cmovbl %eax, %ebx
movq 0x50(%r13), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xe370
movl %ebx, 0x9c(%r13)
movq %rbx, 0x88(%r13)
movq 0x50(%r13), %rax
movzbl (%rax), %edx
movl %edx, 0x70(%r13)
movl 0x80(%r13), %ecx
shll %cl, %edx
movzbl 0x1(%rax), %r9d
xorl %edx, %r9d
movl 0x7c(%r13), %edx
andl %edx, %r9d
movl %r9d, 0x70(%r13)
movq 0x68(%r13), %rsi
movq 0x60(%r13), %rdi
movl 0x4c(%r13), %r8d
leal -0x2(%rbx), %r10d
cmpl $0x1, %r10d
adcl $-0x2, %ebx
xorl %r10d, %r10d
shll %cl, %r9d
leal 0x2(%r10), %r11d
movzbl (%rax,%r11), %r11d
xorl %r9d, %r11d
andl %edx, %r11d
movl %r11d, 0x70(%r13)
movzwl (%rsi,%r11,2), %r9d
movl %r8d, %r15d
andl %r10d, %r15d
movw %r9w, (%rdi,%r15,2)
movw %r10w, (%rsi,%r11,2)
incq %r10
movl %r11d, %r9d
cmpq %r10, %rbx
jne 0x93abe
movl %r14d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: deflateParams
int ZEXPORT deflateParams(strm, level, strategy)
    z_streamp strm;
    int level;
    int strategy;
{
    deflate_state *s;
    compress_func func;
    int err = Z_OK;

    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
    s = strm->state;

#ifdef FASTEST
    if (level != 0) level = 1;
#else
    if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif
    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
        return Z_STREAM_ERROR;
    }
    func = configuration_table[s->level].func;

    if ((strategy != s->strategy || func != configuration_table[level].func) &&
        strm->total_in != 0) {
        /* Flush the last buffer: */
        err = deflate(strm, Z_BLOCK);
    }
    if (s->level != level) {
        s->level = level;
        s->max_lazy_match   = configuration_table[level].max_lazy;
        s->good_match       = configuration_table[level].good_length;
        s->nice_match       = configuration_table[level].nice_length;
        s->max_chain_length = configuration_table[level].max_chain;
    }
    s->strategy = strategy;
    return err;
}

// Assembly:
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x93c31
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x38(%rdi), %r14
testq %r14, %r14
je 0x93c29
movl %edx, %ebx
cmpl $-0x1, %esi
movl $0x6, %ebp
cmovnel %esi, %ebp
cmpl $0xa, %ebp
setae %cl
cmpl $0x5, %edx
setae %dl
orb %cl, %dl
jne 0x93c29
leaq 0x51094(%rip), %r15     # 0xe4c30
movl %ebp, %r12d
cmpl %ebx, 0xb8(%r14)
jne 0x93bc6
movslq 0xb4(%r14), %rax
shlq $0x4, %rax
movq 0x8(%rax,%r15), %rax
movq %r12, %rcx
shlq $0x4, %rcx
cmpq 0x8(%rcx,%r15), %rax
je 0x93bd9
cmpq $0x0, 0x10(%rdi)
je 0x93bd9
movl $0x5, %esi
callq 0x93c32
jmp 0x93bdb
xorl %eax, %eax
cmpl %ebp, 0xb4(%r14)
je 0x93c22
movl %ebp, 0xb4(%r14)
shlq $0x4, %r12
movzwl 0x2(%r12,%r15), %ecx
movl %ecx, 0xb0(%r14)
movzwl (%r12,%r15), %ecx
movl %ecx, 0xbc(%r14)
movzwl 0x4(%r12,%r15), %ecx
movl %ecx, 0xc0(%r14)
movzwl 0x6(%r12,%r15), %ecx
movl %ecx, 0xac(%r14)
movl %ebx, 0xb8(%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: deflateBound
uLong ZEXPORT deflateBound(strm, sourceLen)
    z_streamp strm;
    uLong sourceLen;
{
    deflate_state *s;
    uLong complen, wraplen;
    Bytef *str;

    /* conservative upper bound for compressed data */
    complen = sourceLen +
              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;

    /* if can't get parameters, return conservative bound plus zlib wrapper */
    if (strm == Z_NULL || strm->state == Z_NULL)
        return complen + 6;

    /* compute wrapper length */
    s = strm->state;
    switch (s->wrap) {
    case 0:                                 /* raw deflate */
        wraplen = 0;
        break;
    case 1:                                 /* zlib wrapper */
        wraplen = 6 + (s->strstart ? 4 : 0);
        break;
    case 2:                                 /* gzip wrapper */
        wraplen = 18;
        if (s->gzhead != Z_NULL) {          /* user-supplied gzip header */
            if (s->gzhead->extra != Z_NULL)
                wraplen += 2 + s->gzhead->extra_len;
            str = s->gzhead->name;
            if (str != Z_NULL)
                do {
                    wraplen++;
                } while (*str++);
            str = s->gzhead->comment;
            if (str != Z_NULL)
                do {
                    wraplen++;
                } while (*str++);
            if (s->gzhead->hcrc)
                wraplen += 2;
        }
        break;
    default:                                /* for compiler happiness */
        wraplen = 6;
    }

    /* if not default parameters, return conservative bound */
    if (s->w_bits != 15 || s->hash_bits != 8 + 7)
        return complen + wraplen;

    /* default settings: return tight bound for that case */
    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
           (sourceLen >> 25) + 13 - 6 + wraplen;
}

// Assembly:
leaq 0x7(%rsi), %rax
shrq $0x3, %rax
addq %rsi, %rax
leaq 0x3f(%rsi), %rcx
shrq $0x6, %rcx
testq %rdi, %rdi
je 0x945ec
movq 0x38(%rdi), %rdx
testq %rdx, %rdx
je 0x945ec
movl 0x2c(%rdx), %r9d
testq %r9, %r9
je 0x94660
cmpl $0x2, %r9d
je 0x945f4
cmpl $0x1, %r9d
jne 0x94612
xorl %edi, %edi
cmpl $0x0, 0x9c(%rdx)
setne %dil
leaq 0x6(,%rdi,4), %r9
jmp 0x94660
addq %rcx, %rax
addq $0xb, %rax
retq
movq 0x30(%rdx), %rdi
testq %rdi, %rdi
je 0x9461a
cmpq $0x0, 0x18(%rdi)
je 0x94622
movl 0x20(%rdi), %r8d
addl $0x2, %r8d
addq $0x12, %r8
jmp 0x94628
movl $0x6, %r9d
jmp 0x94660
movl $0x12, %r9d
jmp 0x94660
movl $0x12, %r8d
movq 0x28(%rdi), %r9
testq %r9, %r9
je 0x9463e
incq %r8
cmpb $0x0, (%r9)
leaq 0x1(%r9), %r9
jne 0x94631
movq 0x38(%rdi), %r9
testq %r9, %r9
je 0x94654
incq %r8
cmpb $0x0, (%r9)
leaq 0x1(%r9), %r9
jne 0x94647
leaq 0x2(%r8), %r9
cmpl $0x0, 0x44(%rdi)
cmoveq %r8, %r9
cmpl $0xf, 0x48(%rdx)
jne 0x94692
cmpl $0xf, 0x78(%rdx)
jne 0x94692
movq %rsi, %rax
shrq $0xc, %rax
movq %rsi, %rcx
shrq $0xe, %rcx
movq %rsi, %rdx
shrq $0x19, %rdx
addq %rcx, %rdx
addq %rsi, %rax
addq %rdx, %rax
addq %r9, %rax
addq $0x7, %rax
retq
addq %rcx, %rax
addq $0x5, %rax
addq %r9, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: flush_pending
local void flush_pending(strm)
    z_streamp strm;
{
    unsigned len = strm->state->pending;

    if (len > strm->avail_out) len = strm->avail_out;
    if (len == 0) return;

    zmemcpy(strm->next_out, strm->state->pending_out, len);
    strm->next_out  += len;
    strm->state->pending_out  += len;
    strm->total_out += len;
    strm->avail_out  -= len;
    strm->state->pending -= len;
    if (strm->state->pending == 0) {
        strm->state->pending_out = strm->state->pending_buf;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x38(%rdi), %rax
movl 0x28(%rax), %ecx
movl 0x20(%rdi), %ebp
cmpl %ebp, %ecx
cmovbl %ecx, %ebp
testl %ebp, %ebp
je 0x946ea
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%rax), %rsi
movl %ebp, %r14d
movq %r14, %rdx
callq 0xe370
addq %r14, 0x18(%rbx)
movq 0x38(%rbx), %rax
addq %r14, 0x20(%rax)
addq %r14, 0x28(%rbx)
subl %ebp, 0x20(%rbx)
subl %ebp, 0x28(%rax)
jne 0x946ea
movq 0x10(%rax), %rcx
movq %rcx, 0x20(%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/deflate.c
// Function: deflate_huff
local block_state deflate_huff(s, flush)
    deflate_state *s;
    int flush;
{
    int bflush;             /* set if current block must be flushed */

    for (;;) {
        /* Make sure that we have a literal to write. */
        if (s->lookahead == 0) {
            fill_window(s);
            if (s->lookahead == 0) {
                if (flush == Z_NO_FLUSH)
                    return need_more;
                break;      /* flush the current block */
            }
        }

        /* Output a literal byte */
        s->match_length = 0;
        Tracevv((stderr,"%c", s->window[s->strstart]));
        _tr_tally_lit (s, s->window[s->strstart], bflush);
        s->lookahead--;
        s->strstart++;
        if (bflush) FLUSH_BLOCK(s, 0);
    }
    FLUSH_BLOCK(s, flush == Z_FINISH);
    return flush == Z_FINISH ? finish_done : block_done;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
xorl %ebp, %ebp
cmpl $0x0, 0xa4(%r14)
jne 0x9471a
movq %r14, %rdi
callq 0x9574c
cmpl $0x0, 0xa4(%r14)
je 0x947de
movl $0x0, 0x90(%r14)
movq 0x50(%r14), %rax
movl 0x9c(%r14), %ecx
movzbl (%rax,%rcx), %eax
movq 0x1700(%r14), %rcx
movl 0x16fc(%r14), %edx
movw $0x0, (%rcx,%rdx,2)
movq 0x16f0(%r14), %rcx
leal 0x1(%rdx), %esi
movl %esi, 0x16fc(%r14)
movb %al, (%rcx,%rdx)
incw 0xc4(%r14,%rax,4)
movl 0x16fc(%r14), %ecx
movl 0x16f8(%r14), %edx
decl %edx
decl 0xa4(%r14)
movl 0x9c(%r14), %eax
incl %eax
movl %eax, 0x9c(%r14)
cmpl %edx, %ecx
jne 0x946fa
movq 0x88(%r14), %rcx
testq %rcx, %rcx
js 0x947a8
movl %ecx, %esi
addq 0x50(%r14), %rsi
jmp 0x947aa
xorl %esi, %esi
movl %eax, %edx
subq %rcx, %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x988ce
movl 0x9c(%r14), %eax
movq %rax, 0x88(%r14)
movq (%r14), %rdi
callq 0x9469d
movq (%r14), %rax
cmpl $0x0, 0x20(%rax)
jne 0x946fa
jmp 0x94851
testl %ebx, %ebx
je 0x947f6
movq 0x88(%r14), %rax
testq %rax, %rax
js 0x947fa
movl %eax, %esi
addq 0x50(%r14), %rsi
jmp 0x947fc
xorl %ebp, %ebp
jmp 0x94851
xorl %esi, %esi
movl 0x9c(%r14), %edx
subq %rax, %rdx
xorl %ecx, %ecx
cmpl $0x4, %ebx
sete %cl
movq %r14, %rdi
callq 0x988ce
movl 0x9c(%r14), %eax
movq %rax, 0x88(%r14)
movq (%r14), %rdi
callq 0x9469d
movq (%r14), %rax
cmpl $0x0, 0x20(%rax)
je 0x94846
xorl %eax, %eax
cmpl $0x4, %ebx
sete %al
leal 0x1(,%rax,2), %ebp
jmp 0x94851
xorl %ebp, %ebp
cmpl $0x4, %ebx
sete %bpl
addl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/inflate.c
// Function: inflateReset
int ZEXPORT inflateReset(strm)
z_streamp strm;
{
    struct inflate_state FAR *state;

    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
    state = (struct inflate_state FAR *)strm->state;
    strm->total_in = strm->total_out = state->total = 0;
    strm->msg = Z_NULL;
    strm->adler = 1;        /* to support ill-conceived Java test suite */
    state->mode = HEAD;
    state->last = 0;
    state->havedict = 0;
    state->dmax = 32768U;
    state->head = Z_NULL;
    state->wsize = 0;
    state->whave = 0;
    state->wnext = 0;
    state->hold = 0;
    state->bits = 0;
    state->lencode = state->distcode = state->next = state->codes;
    state->sane = 1;
    state->back = -1;
    Tracev((stderr, "inflate: reset\n"));
    return Z_OK;
}

// Assembly:
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x95c32
movq 0x38(%rdi), %rcx
testq %rcx, %rcx
je 0x95c32
xorl %eax, %eax
movq %rax, 0x20(%rcx)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movq $0x1, 0x60(%rdi)
movq %rax, (%rcx)
movl %eax, 0xc(%rcx)
movl $0x8000, 0x14(%rcx)     # imm = 0x8000
movq %rax, 0x28(%rcx)
movq %rax, 0x34(%rcx)
movl %eax, 0x3c(%rcx)
movq %rax, 0x48(%rcx)
movl %eax, 0x50(%rcx)
leaq 0x550(%rcx), %rdx
movq %rdx, 0x88(%rcx)
movq %rdx, 0x68(%rcx)
movq %rdx, 0x60(%rcx)
movabsq $-0xffffffff, %rdx      # imm = 0xFFFFFFFF00000001
movq %rdx, 0x1be0(%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/inflate.c
// Function: inflateReset2
int ZEXPORT inflateReset2(strm, windowBits)
z_streamp strm;
int windowBits;
{
    int wrap;
    struct inflate_state FAR *state;

    /* get the state */
    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
    state = (struct inflate_state FAR *)strm->state;

    /* extract wrap request from windowBits parameter */
    if (windowBits < 0) {
        wrap = 0;
        windowBits = -windowBits;
    }
    else {
        wrap = (windowBits >> 4) + 1;
#ifdef GUNZIP
        if (windowBits < 48)
            windowBits &= 15;
#endif
    }

    /* set number of window bits, free window if different */
    if (windowBits && (windowBits < 8 || windowBits > 15))
        return Z_STREAM_ERROR;
    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
        ZFREE(strm, state->window);
        state->window = Z_NULL;
    }

    /* update state and reset the rest of it */
    state->wrap = wrap;
    state->wbits = (unsigned)windowBits;
    return inflateReset(strm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x95cb8
movq %rdi, %rbx
movq 0x38(%rdi), %r15
testq %r15, %r15
je 0x95cb8
movl %esi, %r14d
testl %esi, %esi
js 0x95c6d
movl %r14d, %ebp
shrl $0x4, %ebp
incl %ebp
movl %r14d, %eax
andl $0xf, %eax
cmpl $0x30, %r14d
cmovgel %r14d, %eax
movl %eax, %r14d
jmp 0x95c72
negl %r14d
xorl %ebp, %ebp
leal -0x8(%r14), %eax
cmpl $0x8, %eax
jae 0x95cb3
movq 0x40(%r15), %rsi
testq %rsi, %rsi
je 0x95c99
cmpl %r14d, 0x30(%r15)
je 0x95c99
movq 0x50(%rbx), %rdi
callq *0x48(%rbx)
movq $0x0, 0x40(%r15)
movl %ebp, 0x8(%r15)
movl %r14d, 0x30(%r15)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x95bc0
testl %r14d, %r14d
je 0x95c7b
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/inflate.c
// Function: inflateInit2_
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
z_streamp strm;
int windowBits;
const char *version;
int stream_size;
{
    int ret;
    struct inflate_state FAR *state;

    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
        stream_size != (int)(sizeof(z_stream)))
        return Z_VERSION_ERROR;
    if (strm == Z_NULL) return Z_STREAM_ERROR;
    strm->msg = Z_NULL;                 /* in case we return an error */
    if (strm->zalloc == (alloc_func)0) {
        strm->zalloc = zcalloc;
        strm->opaque = (voidpf)0;
    }
    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
    state = (struct inflate_state FAR *)
            ZALLOC(strm, 1, sizeof(struct inflate_state));
    if (state == Z_NULL) return Z_MEM_ERROR;
    Tracev((stderr, "inflate: allocated\n"));
    strm->state = (struct internal_state FAR *)state;
    state->window = Z_NULL;
    ret = inflateReset2(strm, windowBits);
    if (ret != Z_OK) {
        ZFREE(strm, state);
        strm->state = Z_NULL;
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0xfffffffa, %r14d      # imm = 0xFFFFFFFA
testq %rdx, %rdx
je 0x95d8a
cmpl $0x70, %ecx
jne 0x95d8a
cmpb $0x31, (%rdx)
jne 0x95d8a
movq %rdi, %rbx
testq %rdi, %rdi
je 0x95d7c
movl %esi, %ebp
movq $0x0, 0x30(%rbx)
cmpq $0x0, 0x40(%rbx)
jne 0x95d20
leaq 0x4653(%rip), %rax      # 0x9a367
movq %rax, 0x40(%rbx)
movq $0x0, 0x50(%rbx)
cmpq $0x0, 0x48(%rbx)
jne 0x95d32
leaq 0x4643(%rip), %rax      # 0x9a371
movq %rax, 0x48(%rbx)
movq 0x50(%rbx), %rdi
movl $0x1, %esi
movl $0x1bf0, %edx           # imm = 0x1BF0
callq *0x40(%rbx)
testq %rax, %rax
je 0x95d84
movq %rax, %r15
movq %rax, 0x38(%rbx)
movq $0x0, 0x40(%rax)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x95c33
movl %eax, %r14d
testl %eax, %eax
je 0x95d8a
movq 0x50(%rbx), %rdi
movq %r15, %rsi
callq *0x48(%rbx)
movq $0x0, 0x38(%rbx)
jmp 0x95d8a
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
jmp 0x95d8a
movl $0xfffffffc, %r14d      # imm = 0xFFFFFFFC
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/inflate.c
// Function: inflatePrime
int ZEXPORT inflatePrime(strm, bits, value)
z_streamp strm;
int bits;
int value;
{
    struct inflate_state FAR *state;

    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
    state = (struct inflate_state FAR *)strm->state;
    if (bits < 0) {
        state->hold = 0;
        state->bits = 0;
        return Z_OK;
    }
    if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
    value &= (1L << bits) - 1;
    state->hold += value << state->bits;
    state->bits += bits;
    return Z_OK;
}

// Assembly:
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x95e03
movq 0x38(%rdi), %r8
testq %r8, %r8
je 0x95e03
testl %esi, %esi
js 0x95df1
cmpl $0x10, %esi
jg 0x95e03
movl 0x50(%r8), %edi
leal (%rdi,%rsi), %r9d
cmpl $0x20, %r9d
ja 0x95e03
movq $-0x1, %rax
movl %esi, %ecx
shlq %cl, %rax
notl %eax
andl %edx, %eax
movl %edi, %ecx
shll %cl, %eax
cltq
addq %rax, 0x48(%r8)
movl %r9d, 0x50(%r8)
jmp 0x95e01
movq $0x0, 0x48(%r8)
movl $0x0, 0x50(%r8)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/inflate.c
// Function: updatewindow
local int updatewindow(strm, out)
z_streamp strm;
unsigned out;
{
    struct inflate_state FAR *state;
    unsigned copy, dist;

    state = (struct inflate_state FAR *)strm->state;

    /* if it hasn't been done already, allocate space for the window */
    if (state->window == Z_NULL) {
        state->window = (unsigned char FAR *)
                        ZALLOC(strm, 1U << state->wbits,
                               sizeof(unsigned char));
        if (state->window == Z_NULL) return 1;
    }

    /* if window not in use yet, initialize */
    if (state->wsize == 0) {
        state->wsize = 1U << state->wbits;
        state->wnext = 0;
        state->whave = 0;
    }

    /* copy state->wsize or less output bytes into the circular window */
    copy = out - strm->avail_out;
    if (copy >= state->wsize) {
        zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
        state->wnext = 0;
        state->whave = state->wsize;
    }
    else {
        dist = state->wsize - state->wnext;
        if (dist > copy) dist = copy;
        zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
        copy -= dist;
        if (copy) {
            zmemcpy(state->window, strm->next_out - copy, copy);
            state->wnext = copy;
            state->whave = state->wsize;
        }
        else {
            state->wnext += dist;
            if (state->wnext == state->wsize) state->wnext = 0;
            if (state->whave < state->wsize) state->whave += dist;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x38(%rdi), %r13
cmpq $0x0, 0x40(%r13)
jne 0x97679
movq 0x50(%r14), %rdi
movb 0x30(%r13), %cl
movl $0x1, %ebp
movl $0x1, %esi
shll %cl, %esi
movl $0x1, %edx
callq *0x40(%r14)
movq %rax, 0x40(%r13)
testq %rax, %rax
je 0x97710
cmpl $0x0, 0x34(%r13)
jne 0x97697
movb 0x30(%r13), %cl
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x34(%r13)
movq $0x0, 0x38(%r13)
subl 0x20(%r14), %ebx
movl 0x34(%r13), %r15d
cmpl %r15d, %ebx
jae 0x976eb
movl 0x3c(%r13), %edi
subl %edi, %r15d
cmpl %ebx, %r15d
movl %ebx, %r12d
cmovbl %r15d, %r12d
addq 0x40(%r13), %rdi
movq 0x18(%r14), %rsi
movl %ebx, %eax
subq %rax, %rsi
movq %r12, %rdx
callq 0xe370
cmpl %r15d, %ebx
jbe 0x97721
subl %r12d, %ebx
movq 0x40(%r13), %rdi
movq 0x18(%r14), %rsi
subq %rbx, %rsi
movq %rbx, %rdx
callq 0xe370
movl %ebx, 0x3c(%r13)
jmp 0x97706
movq 0x40(%r13), %rdi
movq 0x18(%r14), %rsi
subq %r15, %rsi
movq %r15, %rdx
callq 0xe370
movl $0x0, 0x3c(%r13)
movl 0x34(%r13), %eax
movl %eax, 0x38(%r13)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x3c(%r13), %ecx
addl %r12d, %ecx
movl 0x34(%r13), %edx
movl 0x38(%r13), %eax
xorl %ebp, %ebp
cmpl %edx, %ecx
cmovel %ebp, %ecx
movl %ecx, 0x3c(%r13)
cmpl %edx, %eax
jae 0x97710
addl %r12d, %eax
movl %eax, 0x38(%r13)
jmp 0x97710
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/trees.c
// Function: tr_stored_block
void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
    deflate_state *s;
    charf *buf;       /* input block */
    ulg stored_len;   /* length of input block */
    int last;         /* one if this is the last block for a file */
{
    send_bits(s, (STORED_BLOCK<<1)+last, 3);    /* send block type */
#ifdef DEBUG
    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
    s->compressed_len += (stored_len + 4) << 3;
#endif
    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %ecx, %r8d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x1724(%rdi), %eax
cmpl $0xe, %eax
jl 0x98601
movzwl %r8w, %edx
movl %eax, %ecx
shll %cl, %r8d
orw 0x1720(%r15), %r8w
movw %r8w, 0x1720(%r15)
movq 0x10(%r15), %rax
movl 0x28(%r15), %ecx
leal 0x1(%rcx), %esi
movl %esi, 0x28(%r15)
movb %r8b, (%rax,%rcx)
movb 0x1721(%r15), %al
movq 0x10(%r15), %rcx
movl 0x28(%r15), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x28(%r15)
movb %al, (%rcx,%rsi)
movl 0x1724(%r15), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %edx
movw %dx, 0x1720(%r15)
addl $-0xd, %eax
jmp 0x98611
movl %eax, %ecx
shll %cl, %r8d
orw %r8w, 0x1720(%r15)
addl $0x3, %eax
movl %eax, 0x1724(%r15)
movq %r15, %rdi
callq 0x99b49
movl $0x8, 0x171c(%r15)
movq 0x10(%r15), %rax
movl 0x28(%r15), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x28(%r15)
movb %bl, (%rax,%rcx)
movq 0x10(%r15), %rax
movl 0x28(%r15), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x28(%r15)
movb %bh, (%rax,%rcx)
movl %ebx, %eax
xorl $0xffff, %eax           # imm = 0xFFFF
movq 0x10(%r15), %rcx
movl 0x28(%r15), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%r15)
movb %al, (%rcx,%rdx)
movq 0x10(%r15), %rcx
movl 0x28(%r15), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%r15)
movb %ah, (%rcx,%rdx)
testl %ebx, %ebx
je 0x9869d
xorl %eax, %eax
movb (%r14,%rax), %cl
movq 0x10(%r15), %rdx
movl 0x28(%r15), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x28(%r15)
movb %cl, (%rdx,%rsi)
incq %rax
cmpl %eax, %ebx
jne 0x98680
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/trees.c
// Function: tr_align
void ZLIB_INTERNAL _tr_align(s)
    deflate_state *s;
{
    send_bits(s, STATIC_TREES<<1, 3);
    send_code(s, END_BLOCK, static_ltree);
#ifdef DEBUG
    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
#endif
    bi_flush(s);
    /* Of the 10 bits for the empty block, we have already sent
     * (10 - bi_valid) bits. The lookahead for the last real code (before
     * the EOB of the previous block) was thus at least one plus the length
     * of the EOB plus what we have just sent of the empty static block.
     */
    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
        send_bits(s, STATIC_TREES<<1, 3);
        send_code(s, END_BLOCK, static_ltree);
#ifdef DEBUG
        s->compressed_len += 10L;
#endif
        bi_flush(s);
    }
    s->last_eob_len = 7;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x1724(%rdi), %eax
movl $0x2, %edx
movl $0x2, %esi
movl %eax, %ecx
shll %cl, %esi
orw 0x1720(%rdi), %si
movw %si, 0x1720(%rdi)
cmpl $0xe, %eax
jl 0x9870d
movq 0x10(%rbx), %rax
movl 0x28(%rbx), %ecx
leal 0x1(%rcx), %edi
movl %edi, 0x28(%rbx)
movb %sil, (%rax,%rcx)
movb 0x1721(%rbx), %al
movq 0x10(%rbx), %rcx
movl 0x28(%rbx), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x28(%rbx)
movb %al, (%rcx,%rsi)
movl 0x1724(%rbx), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %edx
movw %dx, 0x1720(%rbx)
addl $-0xd, %eax
jmp 0x98710
addl $0x3, %eax
movl %eax, 0x1724(%rbx)
cmpl $0xa, %eax
jl 0x9875b
movb 0x1720(%rbx), %al
movq 0x10(%rbx), %rcx
movl 0x28(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rbx)
movb %al, (%rcx,%rdx)
movb 0x1721(%rbx), %al
movq 0x10(%rbx), %rcx
movl 0x28(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rbx)
movb %al, (%rcx,%rdx)
movw $0x0, 0x1720(%rbx)
movl 0x1724(%rbx), %eax
addl $-0x9, %eax
jmp 0x9875e
addl $0x7, %eax
movl %eax, 0x1724(%rbx)
movq %rbx, %rdi
callq 0x98851
movl 0x171c(%rbx), %ecx
movl 0x1724(%rbx), %eax
subl %eax, %ecx
addl $0xb, %ecx
cmpl $0x8, %ecx
jg 0x98845
movl $0x2, %edx
movl $0x2, %esi
movl %eax, %ecx
shll %cl, %esi
orw 0x1720(%rbx), %si
movw %si, 0x1720(%rbx)
cmpl $0xe, %eax
jl 0x987e6
movq 0x10(%rbx), %rax
movl 0x28(%rbx), %ecx
leal 0x1(%rcx), %edi
movl %edi, 0x28(%rbx)
movb %sil, (%rax,%rcx)
movb 0x1721(%rbx), %al
movq 0x10(%rbx), %rcx
movl 0x28(%rbx), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x28(%rbx)
movb %al, (%rcx,%rsi)
movl 0x1724(%rbx), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %edx
movw %dx, 0x1720(%rbx)
addl $-0xd, %eax
jmp 0x987e9
addl $0x3, %eax
movl %eax, 0x1724(%rbx)
cmpl $0xa, %eax
jl 0x98834
movb 0x1720(%rbx), %al
movq 0x10(%rbx), %rcx
movl 0x28(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rbx)
movb %al, (%rcx,%rdx)
movb 0x1721(%rbx), %al
movq 0x10(%rbx), %rcx
movl 0x28(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rbx)
movb %al, (%rcx,%rdx)
movw $0x0, 0x1720(%rbx)
movl 0x1724(%rbx), %eax
addl $-0x9, %eax
jmp 0x98837
addl $0x7, %eax
movl %eax, 0x1724(%rbx)
movq %rbx, %rdi
callq 0x98851
movl $0x7, 0x171c(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/trees.c
// Function: bi_flush
local void bi_flush(s)
    deflate_state *s;
{
    if (s->bi_valid == 16) {
        put_short(s, s->bi_buf);
        s->bi_buf = 0;
        s->bi_valid = 0;
    } else if (s->bi_valid >= 8) {
        put_byte(s, (Byte)s->bi_buf);
        s->bi_buf >>= 8;
        s->bi_valid -= 8;
    }
}

// Assembly:
movl 0x1724(%rdi), %eax
cmpl $0x10, %eax
jne 0x98895
movb 0x1720(%rdi), %al
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rdi)
movb %al, (%rcx,%rdx)
movb 0x1721(%rdi), %al
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rdi)
movb %al, (%rcx,%rdx)
movw $0x0, 0x1720(%rdi)
xorl %eax, %eax
jmp 0x988c7
cmpl $0x8, %eax
jl 0x988cd
movb 0x1720(%rdi), %al
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rdi)
movb %al, (%rcx,%rdx)
movzbl 0x1721(%rdi), %eax
movw %ax, 0x1720(%rdi)
movl 0x1724(%rdi), %eax
addl $-0x8, %eax
movl %eax, 0x1724(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/trees.c
// Function: bi_windup
local void bi_windup(s)
    deflate_state *s;
{
    if (s->bi_valid > 8) {
        put_short(s, s->bi_buf);
    } else if (s->bi_valid > 0) {
        put_byte(s, (Byte)s->bi_buf);
    }
    s->bi_buf = 0;
    s->bi_valid = 0;
#ifdef DEBUG
    s->bits_sent = (s->bits_sent+7) & ~7;
#endif
}

// Assembly:
movl 0x1724(%rdi), %eax
cmpl $0x9, %eax
jl 0x99b7f
movb 0x1720(%rdi), %dl
leaq 0x10(%rdi), %rcx
movq 0x10(%rdi), %rsi
leaq 0x28(%rdi), %rax
movl 0x28(%rdi), %r8d
leal 0x1(%r8), %r9d
movl %r9d, 0x28(%rdi)
movb %dl, (%rsi,%r8)
movzbl 0x1721(%rdi), %edx
jmp 0x99b92
testl %eax, %eax
jle 0x99ba1
movzwl 0x1720(%rdi), %edx
leaq 0x10(%rdi), %rcx
leaq 0x28(%rdi), %rax
movq (%rcx), %rcx
movl (%rax), %esi
leal 0x1(%rsi), %r8d
movl %r8d, (%rax)
movb %dl, (%rcx,%rsi)
movw $0x0, 0x1720(%rdi)
movl $0x0, 0x1724(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/trees.c
// Function: pqdownheap
local void pqdownheap(s, tree, k)
    deflate_state *s;
    ct_data *tree;  /* the tree to restore */
    int k;               /* node to move down */
{
    int v = s->heap[k];
    int j = k << 1;  /* left son of k */
    while (j <= s->heap_len) {
        /* Set j to the smallest of the two sons: */
        if (j < s->heap_len &&
            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
            j++;
        }
        /* Exit if v is smaller than both sons */
        if (smaller(tree, v, s->heap[j], s->depth)) break;

        /* Exchange v with the smallest son */
        s->heap[k] = s->heap[j];  k = j;

        /* And continue down the tree, setting j to the left son of k */
        j <<= 1;
    }
    s->heap[k] = v;
}

// Assembly:
movl %edx, %eax
movl 0xbb0(%rdi,%rax,4), %eax
leal (%rdx,%rdx), %r9d
movl 0x14a4(%rdi), %r10d
cmpl %r10d, %r9d
jle 0x99c6c
movl %edx, %r8d
jmp 0x99d15
pushq %rbx
movslq %eax, %rcx
cmpl %r10d, %r9d
jge 0x99cbc
movl %r9d, %r10d
orl $0x1, %r10d
movslq %r10d, %r8
movslq 0xbb0(%rdi,%r8,4), %r8
movslq %r9d, %r11
movslq 0xbb0(%rdi,%r11,4), %r11
movzwl (%rsi,%r11,4), %ebx
cmpw %bx, (%rsi,%r8,4)
jae 0x99ca3
movl %r10d, %r8d
jmp 0x99cbf
jne 0x99cbc
movb 0x14ac(%rdi,%r8), %bl
movl %r9d, %r8d
cmpb 0x14ac(%rdi,%r11), %bl
jbe 0x99c9e
jmp 0x99cbf
movl %r9d, %r8d
movslq %r8d, %r9
movl 0xbb0(%rdi,%r9,4), %r9d
movslq %r9d, %r10
movzwl (%rsi,%r10,4), %r11d
cmpw %r11w, (%rsi,%rcx,4)
jb 0x99d11
jne 0x99ced
movb 0x14ac(%rdi,%rcx), %r11b
cmpb 0x14ac(%rdi,%r10), %r11b
jbe 0x99d11
movslq %edx, %rdx
movl %r9d, 0xbb0(%rdi,%rdx,4)
leal (%r8,%r8), %r9d
movl 0x14a4(%rdi), %r10d
movl %r8d, %edx
cmpl %r10d, %r9d
jle 0x99c70
jmp 0x99d14
movl %edx, %r8d
popq %rbx
movslq %r8d, %rcx
movl %eax, 0xbb0(%rdi,%rcx,4)
retq