LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdsample.c
// Function: h2v2_upsample
METHODDEF(void)
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
	       JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
  JSAMPARRAY output_data = *output_data_ptr;
  register JSAMPROW inptr, outptr;
  register JSAMPLE invalue;
  JSAMPROW outend;
  int inrow, outrow;

  inrow = outrow = 0;
  while (outrow < cinfo->max_v_samp_factor) {
    inptr = input_data[inrow];
    outptr = output_data[outrow];
    outend = outptr + cinfo->output_width;
    while (outptr < outend) {
      invalue = *inptr++;	/* don't need GETJSAMPLE() here */
      *outptr++ = invalue;
      *outptr++ = invalue;
    }
    jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
		      1, cinfo->output_width);
    inrow++;
    outrow += 2;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq (%rcx), %r15
xorl %r12d, %r12d
pushq $0x1
popq %rbp
xorl %r13d, %r13d
movslq 0x19c(%r14), %rax
cmpq %rax, %r12
jge 0x76795
movq (%rbx,%r13,8), %rax
movq (%r15,%r12,8), %rcx
movl 0x88(%r14), %edx
addq %rcx, %rdx
cmpq %rdx, %rcx
jae 0x7676e
movb (%rax), %sil
incq %rax
movb %sil, (%rcx)
movb %sil, 0x1(%rcx)
addq $0x2, %rcx
jmp 0x76756
movl %r12d, %ecx
orl $0x1, %ecx
movl 0x88(%r14), %r9d
movq %r15, %rdi
movl %r12d, %esi
movq %r15, %rdx
movl %ebp, %r8d
callq 0x79173
incq %r13
addq $0x2, %r12
jmp 0x76738
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdsample.c
// Function: int_upsample
METHODDEF(void)
int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
	      JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
  JSAMPARRAY output_data = *output_data_ptr;
  register JSAMPROW inptr, outptr;
  register JSAMPLE invalue;
  register int h;
  JSAMPROW outend;
  int h_expand, v_expand;
  int inrow, outrow;

  h_expand = upsample->h_expand[compptr->component_index];
  v_expand = upsample->v_expand[compptr->component_index];

  inrow = outrow = 0;
  while (outrow < cinfo->max_v_samp_factor) {
    /* Generate one output row with proper horizontal expansion */
    inptr = input_data[inrow];
    outptr = output_data[outrow];
    outend = outptr + cinfo->output_width;
    while (outptr < outend) {
      invalue = *inptr++;	/* don't need GETJSAMPLE() here */
      for (h = h_expand; h > 0; h--) {
	*outptr++ = invalue;
      }
    }
    /* Generate any additional output rows by duplicating the first one */
    if (v_expand > 1) {
      jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
			v_expand-1, cinfo->output_width);
    }
    inrow++;
    outrow += v_expand;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rdi, %r11
movq 0x260(%rdi), %rax
movq (%rcx), %rbp
movslq 0x4(%rsi), %rcx
movzbl 0xe8(%rax,%rcx), %r13d
movzbl 0xf2(%rax,%rcx), %r14d
leal -0x1(%r14), %eax
movl %eax, 0xc(%rsp)
xorl %r12d, %r12d
xorl %r15d, %r15d
movq %rdx, 0x10(%rsp)
movslq 0x19c(%r11), %rax
cmpq %rax, %r12
jge 0x76862
movq (%r8,%r15,8), %rax
movq (%rbp,%r12,8), %rcx
movl 0x88(%r11), %edx
addq %rcx, %rdx
cmpq %rdx, %rcx
jae 0x7682a
movb (%rax), %sil
movl %r13d, %r9d
testl %r9d, %r9d
jle 0x76825
movb %sil, (%rcx)
incq %rcx
decl %r9d
jmp 0x76815
incq %rax
jmp 0x7680a
cmpb $0x2, %r14b
jb 0x7685a
leal 0x1(%r12), %ecx
movl 0x88(%r11), %r9d
movq %rbp, %rdi
movl %r12d, %esi
movq %rbp, %rdx
movl 0xc(%rsp), %r8d
movq %r11, %rbx
callq 0x79173
movq %rbx, %r11
movq 0x10(%rsp), %r8
incq %r15
addq %r14, %r12
jmp 0x767eb
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcolor.c
// Function: ycc_rgb_convert
METHODDEF(void)
ycc_rgb_convert (j_decompress_ptr cinfo,
		 JSAMPIMAGE input_buf, JDIMENSION input_row,
		 JSAMPARRAY output_buf, int num_rows)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  register int y, cb, cr;
  register JSAMPROW outptr;
  register JSAMPROW inptr0, inptr1, inptr2;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->output_width;
  /* copy these pointers into registers if possible */
  register JSAMPLE * range_limit = cinfo->sample_range_limit;
  register int * Crrtab = cconvert->Cr_r_tab;
  register int * Cbbtab = cconvert->Cb_b_tab;
  register INT32 * Crgtab = cconvert->Cr_g_tab;
  register INT32 * Cbgtab = cconvert->Cb_g_tab;
  SHIFT_TEMPS

  while (--num_rows >= 0) {
    inptr0 = input_buf[0][input_row];
    inptr1 = input_buf[1][input_row];
    inptr2 = input_buf[2][input_row];
    input_row++;
    outptr = *output_buf++;
    for (col = 0; col < num_cols; col++) {
      y  = GETJSAMPLE(inptr0[col]);
      cb = GETJSAMPLE(inptr1[col]);
      cr = GETJSAMPLE(inptr2[col]);
      /* Range-limiting is essential due to noise introduced by DCT losses. */
      outptr[RGB_RED] =   range_limit[y + Crrtab[cr]];
      outptr[RGB_GREEN] = range_limit[y +
			      ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
						 SCALEBITS))];
      outptr[RGB_BLUE] =  range_limit[y + Cbbtab[cb]];
      outptr += RGB_PIXELSIZE;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, -0x10(%rsp)
movq 0x268(%rdi), %rbx
movl 0x88(%rdi), %eax
movq 0x1a8(%rdi), %rdi
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %r10
movq 0x20(%rbx), %r11
movq 0x28(%rbx), %rbx
testl %r8d, %r8d
jle 0x76af2
decl %r8d
movl %r8d, -0x14(%rsp)
movl %edx, %r12d
movq -0x10(%rsp), %r8
movq (%r8), %r14
movq 0x8(%r8), %r15
movq (%r14,%r12,8), %r14
movq (%r15,%r12,8), %r15
movq 0x10(%r8), %r13
movq (%r13,%r12,8), %r12
incl %edx
movl %edx, -0x18(%rsp)
movq %rcx, -0x8(%rsp)
movq (%rcx), %r13
xorl %ebp, %ebp
cmpq %rbp, %rax
je 0x76adb
movzbl (%r14,%rbp), %r9d
movzbl (%r15,%rbp), %ecx
movzbl (%r12,%rbp), %r8d
movslq (%rsi,%r8,4), %rdx
addq %r9, %rdx
movb (%rdi,%rdx), %dl
movb %dl, (%r13)
movq (%r11,%r8,8), %rdx
addq (%rbx,%rcx,8), %rdx
shrq $0x10, %rdx
movslq %edx, %rdx
addq %r9, %rdx
movb (%rdi,%rdx), %dl
movb %dl, 0x1(%r13)
movslq (%r10,%rcx,4), %rcx
addq %r9, %rcx
movb (%rdi,%rcx), %cl
movb %cl, 0x2(%r13)
addq $0x3, %r13
incq %rbp
jmp 0x76a89
movq -0x8(%rsp), %rcx
addq $0x8, %rcx
movl -0x14(%rsp), %r8d
movl -0x18(%rsp), %edx
jmp 0x76a48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcolor.c
// Function: build_ycc_rgb_table
LOCAL(void)
build_ycc_rgb_table (j_decompress_ptr cinfo)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  int i;
  INT32 x;
  SHIFT_TEMPS

  cconvert->Cr_r_tab = (int *)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				(MAXJSAMPLE+1) * SIZEOF(int));
  cconvert->Cb_b_tab = (int *)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				(MAXJSAMPLE+1) * SIZEOF(int));
  cconvert->Cr_g_tab = (INT32 *)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				(MAXJSAMPLE+1) * SIZEOF(INT32));
  cconvert->Cb_g_tab = (INT32 *)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				(MAXJSAMPLE+1) * SIZEOF(INT32));

  for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
    /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
    /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
    /* Cr=>R value is nearest int to 1.40200 * x */
    cconvert->Cr_r_tab[i] = (int)
		    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
    /* Cb=>B value is nearest int to 1.77200 * x */
    cconvert->Cb_b_tab[i] = (int)
		    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
    /* Cr=>G value is scaled-up -0.71414 * x */
    cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
    /* Cb=>G value is scaled-up -0.34414 * x */
    /* We also add in ONE_HALF so that need not do it in inner loop */
    cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x268(%rdi), %r14
movq 0x8(%rdi), %rax
pushq $0x1
popq %rbp
movl $0x400, %edx            # imm = 0x400
movl %ebp, %esi
callq *(%rax)
movq %rax, 0x10(%r14)
movq 0x8(%rbx), %rax
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rdi
movl %ebp, %esi
callq *(%rax)
movq %rax, 0x18(%r14)
movq 0x8(%rbx), %rax
movl $0x800, %edx            # imm = 0x800
movq %rbx, %rdi
movl %ebp, %esi
callq *(%rax)
movq %rax, 0x20(%r14)
movq 0x8(%rbx), %rax
movl $0x800, %edx            # imm = 0x800
movq %rbx, %rdi
movl %ebp, %esi
callq *(%rax)
movq %rax, 0x28(%r14)
movq 0x10(%r14), %rcx
movq 0x18(%r14), %rdx
movq 0x20(%r14), %rsi
movl $0x2c8d00, %edi         # imm = 0x2C8D00
movl $0x5b6900, %r8d         # imm = 0x5B6900
movq $-0xe25100, %r9         # imm = 0xFF1DAF00
movq $-0xb2f480, %r10        # imm = 0xFF4D0B80
xorl %r11d, %r11d
cmpq $0x400, %r11            # imm = 0x400
je 0x76bcc
movq %r10, %rbx
shrq $0x10, %rbx
movl %ebx, (%rcx,%r11)
movq %r9, %rbx
shrq $0x10, %rbx
movl %ebx, (%rdx,%r11)
movq %r8, (%rsi,%r11,2)
movq %rdi, (%rax,%r11,2)
addq $0x4, %r11
addq $-0x581a, %rdi          # imm = 0xA7E6
addq $-0xb6d2, %r8           # imm = 0xFFFF492E
addq $0x1c5a2, %r9           # imm = 0x1C5A2
addq $0x166e9, %r10          # imm = 0x166E9
jmp 0x76b83
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcolor.c
// Function: gray_rgb_convert
METHODDEF(void)
gray_rgb_convert (j_decompress_ptr cinfo,
		  JSAMPIMAGE input_buf, JDIMENSION input_row,
		  JSAMPARRAY output_buf, int num_rows)
{
  register JSAMPROW inptr, outptr;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->output_width;

  while (--num_rows >= 0) {
    inptr = input_buf[0][input_row++];
    outptr = *output_buf++;
    for (col = 0; col < num_cols; col++) {
      /* We can dispense with GETJSAMPLE() here */
      outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
      outptr += RGB_PIXELSIZE;
    }
  }
}

// Assembly:
movl 0x88(%rdi), %eax
testl %r8d, %r8d
jle 0x76c18
decl %r8d
movq (%rsi), %rdi
movl %edx, %r9d
movq (%rdi,%r9,8), %rdi
movq (%rcx), %r9
addq $0x2, %r9
xorl %r10d, %r10d
cmpq %r10, %rax
je 0x76c10
movb (%rdi,%r10), %r11b
movb %r11b, (%r9)
movb %r11b, -0x1(%r9)
movb %r11b, -0x2(%r9)
incq %r10
addq $0x3, %r9
jmp 0x76bf3
incl %edx
addq $0x8, %rcx
jmp 0x76bd7
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcolor.c
// Function: null_convert
METHODDEF(void)
null_convert (j_decompress_ptr cinfo,
	      JSAMPIMAGE input_buf, JDIMENSION input_row,
	      JSAMPARRAY output_buf, int num_rows)
{
  register JSAMPROW inptr, outptr;
  register JDIMENSION count;
  register int num_components = cinfo->num_components;
  JDIMENSION num_cols = cinfo->output_width;
  int ci;

  while (--num_rows >= 0) {
    for (ci = 0; ci < num_components; ci++) {
      inptr = input_buf[ci][input_row];
      outptr = output_buf[0] + ci;
      for (count = num_cols; count > 0; count--) {
	*outptr = *inptr++;	/* needn't bother with GETJSAMPLE() here */
	outptr += num_components;
      }
    }
    input_row++;
    output_buf++;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movslq 0x38(%rdi), %rax
movl 0x88(%rdi), %edi
xorl %r9d, %r9d
testl %eax, %eax
cmovgl %eax, %r9d
testl %r8d, %r8d
jle 0x76c77
decl %r8d
movl %edx, %r10d
xorl %r11d, %r11d
cmpq %r9, %r11
je 0x76c6f
movq (%rsi,%r11,8), %rbx
movq (%rbx,%r10,8), %rbx
movq (%rcx), %r14
addq %r11, %r14
xorl %r15d, %r15d
cmpl %r15d, %edi
je 0x76c6a
movb (%rbx,%r15), %bpl
movb %bpl, (%r14)
addq %rax, %r14
incq %r15
jmp 0x76c56
incq %r11
jmp 0x76c40
incl %edx
addq $0x8, %rcx
jmp 0x76c32
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcolor.c
// Function: ycck_cmyk_convert
METHODDEF(void)
ycck_cmyk_convert (j_decompress_ptr cinfo,
		   JSAMPIMAGE input_buf, JDIMENSION input_row,
		   JSAMPARRAY output_buf, int num_rows)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  register int y, cb, cr;
  register JSAMPROW outptr;
  register JSAMPROW inptr0, inptr1, inptr2, inptr3;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->output_width;
  /* copy these pointers into registers if possible */
  register JSAMPLE * range_limit = cinfo->sample_range_limit;
  register int * Crrtab = cconvert->Cr_r_tab;
  register int * Cbbtab = cconvert->Cb_b_tab;
  register INT32 * Crgtab = cconvert->Cr_g_tab;
  register INT32 * Cbgtab = cconvert->Cb_g_tab;
  SHIFT_TEMPS

  while (--num_rows >= 0) {
    inptr0 = input_buf[0][input_row];
    inptr1 = input_buf[1][input_row];
    inptr2 = input_buf[2][input_row];
    inptr3 = input_buf[3][input_row];
    input_row++;
    outptr = *output_buf++;
    for (col = 0; col < num_cols; col++) {
      y  = GETJSAMPLE(inptr0[col]);
      cb = GETJSAMPLE(inptr1[col]);
      cr = GETJSAMPLE(inptr2[col]);
      /* Range-limiting is essential due to noise introduced by DCT losses. */
      outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])];	/* red */
      outptr[1] = range_limit[MAXJSAMPLE - (y +			/* green */
			      ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
						 SCALEBITS)))];
      outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])];	/* blue */
      /* K passes through unchanged */
      outptr[3] = inptr3[col];	/* don't need GETJSAMPLE here */
      outptr += 4;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, -0x20(%rsp)
movq 0x268(%rdi), %r9
movl 0x88(%rdi), %eax
movq %rax, -0x8(%rsp)
movq 0x1a8(%rdi), %rdi
movq 0x10(%r9), %rsi
movq %rsi, -0x10(%rsp)
movq 0x18(%r9), %r10
movq 0x20(%r9), %r11
movq 0x28(%r9), %rbx
movq -0x10(%rsp), %rax
testl %r8d, %r8d
jle 0x76d86
decl %r8d
movl %r8d, -0x24(%rsp)
movl %edx, %r9d
movq -0x20(%rsp), %rsi
movq (%rsi), %r14
movq 0x8(%rsi), %r15
movq (%r14,%r9,8), %r14
movq (%r15,%r9,8), %r15
movq 0x10(%rsi), %r12
movq (%r12,%r9,8), %r12
movq 0x18(%rsi), %r13
movq (%r13,%r9,8), %r13
incl %edx
movl %edx, -0x28(%rsp)
movq %rcx, -0x18(%rsp)
movq (%rcx), %rbp
xorl %r9d, %r9d
cmpq %r9, -0x8(%rsp)
je 0x76d6f
movzbl (%r14,%r9), %esi
movzbl (%r15,%r9), %r8d
movzbl (%r12,%r9), %edx
xorl $0xff, %esi
movl %esi, %ecx
subl (%rax,%rdx,4), %ecx
movslq %ecx, %rcx
movb (%rdi,%rcx), %cl
movb %cl, (%rbp,%r9,4)
movq (%r11,%rdx,8), %rcx
addq (%rbx,%r8,8), %rcx
shrq $0x10, %rcx
movl %esi, %edx
subl %ecx, %edx
movslq %edx, %rcx
movb (%rdi,%rcx), %cl
movb %cl, 0x1(%rbp,%r9,4)
subl (%r10,%r8,4), %esi
movslq %esi, %rcx
movb (%rdi,%rcx), %cl
movb %cl, 0x2(%rbp,%r9,4)
movb (%r13,%r9), %cl
movb %cl, 0x3(%rbp,%r9,4)
incq %r9
jmp 0x76d0a
movq -0x18(%rsp), %rcx
addq $0x8, %rcx
movl -0x24(%rsp), %r8d
movl -0x28(%rsp), %edx
jmp 0x76cc0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant1.c
// Function: alloc_fs_workspace
LOCAL(void)
alloc_fs_workspace (j_decompress_ptr cinfo)
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  size_t arraysize;
  int i;

  arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR));
  for (i = 0; i < cinfo->out_color_components; i++) {
    cquantize->fserrors[i] = (FSERRPTR)
      (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x270(%rdi), %r15
movl 0x88(%rdi), %r14d
addl $0x2, %r14d
addq %r14, %r14
xorl %r12d, %r12d
pushq $0x1
popq %rbp
movslq 0x90(%rbx), %rax
cmpq %rax, %r12
jge 0x773bb
movq 0x8(%rbx), %rax
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq *0x8(%rax)
movq %rax, 0x70(%r15,%r12,8)
incq %r12
jmp 0x77396
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant1.c
// Function: color_quantize3
METHODDEF(void)
color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
		 JSAMPARRAY output_buf, int num_rows)
/* Fast path for out_color_components==3, no dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  register int pixcode;
  register JSAMPROW ptrin, ptrout;
  JSAMPROW colorindex0 = cquantize->colorindex[0];
  JSAMPROW colorindex1 = cquantize->colorindex[1];
  JSAMPROW colorindex2 = cquantize->colorindex[2];
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;

  for (row = 0; row < num_rows; row++) {
    ptrin = input_buf[row];
    ptrout = output_buf[row];
    for (col = width; col > 0; col--) {
      pixcode  = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]);
      pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]);
      pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]);
      *ptrout++ = (JSAMPLE) pixcode;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x270(%rdi), %rax
movq 0x30(%rax), %r9
movq (%r9), %rax
movq 0x8(%r9), %r8
movq 0x10(%r9), %r9
movl 0x88(%rdi), %edi
xorl %r10d, %r10d
testl %ecx, %ecx
cmovlel %r10d, %ecx
cmpq %rcx, %r10
je 0x77432
movq (%rsi,%r10,8), %r11
movq (%rdx,%r10,8), %rbx
xorl %r14d, %r14d
cmpl %r14d, %edi
je 0x7742d
movzbl (%r11), %r15d
movzbl 0x1(%r11), %r12d
movb (%r8,%r12), %bpl
addb (%rax,%r15), %bpl
movzbl 0x2(%r11), %r15d
addb (%r9,%r15), %bpl
movb %bpl, (%rbx,%r14)
incq %r14
addq $0x3, %r11
jmp 0x77401
incq %r10
jmp 0x773f1
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant1.c
// Function: color_quantize
METHODDEF(void)
color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
		JSAMPARRAY output_buf, int num_rows)
/* General case, no dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  JSAMPARRAY colorindex = cquantize->colorindex;
  register int pixcode, ci;
  register JSAMPROW ptrin, ptrout;
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;
  register int nc = cinfo->out_color_components;

  for (row = 0; row < num_rows; row++) {
    ptrin = input_buf[row];
    ptrout = output_buf[row];
    for (col = width; col > 0; col--) {
      pixcode = 0;
      for (ci = 0; ci < nc; ci++) {
	pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]);
      }
      *ptrout++ = (JSAMPLE) pixcode;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x270(%rdi), %rax
movq 0x30(%rax), %rax
movl 0x90(%rdi), %r8d
xorl %r9d, %r9d
testl %r8d, %r8d
cmovlel %r9d, %r8d
movl 0x88(%rdi), %edi
testl %ecx, %ecx
cmovlel %r9d, %ecx
cmpq %rcx, %r9
je 0x774ad
movq (%rsi,%r9,8), %r10
movq (%rdx,%r9,8), %r11
movl %edi, %ebx
subl $0x1, %ebx
jb 0x774a8
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq %r14, %r8
je 0x7749d
movq (%rax,%r14,8), %r12
movzbl (%r10,%r14), %r13d
addb (%r12,%r13), %r15b
incq %r14
jmp 0x77486
addq %r8, %r10
movb %r15b, (%r11)
incq %r11
jmp 0x7747b
incq %r9
jmp 0x7746c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant1.c
// Function: quantize3_ord_dither
METHODDEF(void)
quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
		      JSAMPARRAY output_buf, int num_rows)
/* Fast path for out_color_components==3, with ordered dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  register int pixcode;
  register JSAMPROW input_ptr;
  register JSAMPROW output_ptr;
  JSAMPROW colorindex0 = cquantize->colorindex[0];
  JSAMPROW colorindex1 = cquantize->colorindex[1];
  JSAMPROW colorindex2 = cquantize->colorindex[2];
  int * dither0;		/* points to active row of dither matrix */
  int * dither1;
  int * dither2;
  int row_index, col_index;	/* current indexes into dither matrix */
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;

  for (row = 0; row < num_rows; row++) {
    row_index = cquantize->row_index;
    input_ptr = input_buf[row];
    output_ptr = output_buf[row];
    dither0 = cquantize->odither[0][row_index];
    dither1 = cquantize->odither[1][row_index];
    dither2 = cquantize->odither[2][row_index];
    col_index = 0;

    for (col = width; col > 0; col--) {
      pixcode  = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) +
					dither0[col_index]]);
      pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) +
					dither1[col_index]]);
      pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) +
					dither2[col_index]]);
      *output_ptr++ = (JSAMPLE) pixcode;
      col_index = (col_index + 1) & ODITHER_MASK;
    }
    row_index = (row_index + 1) & ODITHER_MASK;
    cquantize->row_index = row_index;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, -0x20(%rsp)
movq %rsi, -0x28(%rsp)
movq 0x270(%rdi), %rsi
movq 0x30(%rsi), %rdx
movq (%rdx), %r8
movq 0x8(%rdx), %r9
movq 0x10(%rdx), %r10
movl 0x88(%rdi), %edi
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
movq %rcx, -0x18(%rsp)
movq %rsi, -0x30(%rsp)
cmpq -0x18(%rsp), %rdx
je 0x775a5
movslq 0x4c(%rsi), %r12
movq -0x28(%rsp), %rax
movq (%rax,%rdx,8), %r14
movq -0x20(%rsp), %rax
movq %rdx, -0x8(%rsp)
movq (%rax,%rdx,8), %r15
movq %r12, -0x10(%rsp)
shlq $0x6, %r12
movq 0x50(%rsi), %r13
addq %r12, %r13
movq 0x58(%rsi), %rbp
addq %r12, %rbp
addq 0x60(%rsi), %r12
xorl %ebx, %ebx
xorl %edx, %edx
cmpl %ebx, %edi
je 0x77586
movzbl (%r14), %esi
movl %edx, %ecx
movslq (%r13,%rcx,4), %rax
addq %rsi, %rax
movzbl 0x1(%r14), %esi
movslq (%rbp,%rcx,4), %r11
addq %rsi, %r11
movb (%r9,%r11), %sil
addb (%r8,%rax), %sil
movzbl 0x2(%r14), %eax
movslq (%r12,%rcx,4), %rcx
addq %rax, %rcx
addb (%r10,%rcx), %sil
movb %sil, (%r15,%rbx)
incl %edx
andl $0xf, %edx
incq %rbx
addq $0x3, %r14
jmp 0x7753d
movq -0x10(%rsp), %rax
incl %eax
andl $0xf, %eax
movq -0x30(%rsp), %rsi
movl %eax, 0x4c(%rsi)
movq -0x8(%rsp), %rdx
incq %rdx
jmp 0x774f8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant1.c
// Function: quantize_ord_dither
METHODDEF(void)
quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
		     JSAMPARRAY output_buf, int num_rows)
/* General case, with ordered dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  register JSAMPROW input_ptr;
  register JSAMPROW output_ptr;
  JSAMPROW colorindex_ci;
  int * dither;			/* points to active row of dither matrix */
  int row_index, col_index;	/* current indexes into dither matrix */
  int nc = cinfo->out_color_components;
  int ci;
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;

  for (row = 0; row < num_rows; row++) {
    /* Initialize output values to 0 so can process components separately */
    jzero_far((void FAR *) output_buf[row],
	      (size_t) (width * SIZEOF(JSAMPLE)));
    row_index = cquantize->row_index;
    for (ci = 0; ci < nc; ci++) {
      input_ptr = input_buf[row] + ci;
      output_ptr = output_buf[row];
      colorindex_ci = cquantize->colorindex[ci];
      dither = cquantize->odither[ci][row_index];
      col_index = 0;

      for (col = width; col > 0; col--) {
	/* Form pixel value + dither, range-limit to 0..MAXJSAMPLE,
	 * select output value, accumulate into output code for this pixel.
	 * Range-limiting need not be done explicitly, as we have extended
	 * the colorindex table to produce the right answers for out-of-range
	 * inputs.  The maximum dither is +- MAXJSAMPLE; this sets the
	 * required amount of padding.
	 */
	*output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]];
	input_ptr += nc;
	output_ptr++;
	col_index = (col_index + 1) & ODITHER_MASK;
      }
    }
    /* Advance row index for next row */
    row_index = (row_index + 1) & ODITHER_MASK;
    cquantize->row_index = row_index;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x270(%rdi), %r13
movslq 0x90(%rdi), %rbp
xorl %ebx, %ebx
testl %ebp, %ebp
movl $0x0, %r15d
cmovgl %ebp, %r15d
movl 0x88(%rdi), %r12d
testl %ecx, %ecx
cmovlel %ebx, %ecx
movq %rcx, 0x10(%rsp)
cmpq 0x10(%rsp), %rbx
je 0x77694
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq %r12, %rsi
callq 0x791cd
movslq 0x4c(%r13), %rcx
movq %rcx, 0x18(%rsp)
shlq $0x6, %rcx
xorl %edx, %edx
cmpq %r15, %rdx
je 0x7767e
movq 0x20(%rsp), %rax
movq (%rax,%rbx,8), %rsi
addq %rdx, %rsi
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq 0x30(%r13), %r8
movq (%r8,%rdx,8), %r8
movq 0x50(%r13,%rdx,8), %r9
addq %rcx, %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpl %r10d, %r12d
je 0x77679
movzbl (%rsi), %eax
movl %r11d, %r14d
movslq (%r9,%r14,4), %r14
addq %rax, %r14
movb (%r8,%r14), %al
addb %al, (%rdi,%r10)
addq %rbp, %rsi
incl %r11d
andl $0xf, %r11d
incq %r10
jmp 0x77650
incq %rdx
jmp 0x77620
movq 0x18(%rsp), %rax
incl %eax
andl $0xf, %eax
movl %eax, 0x4c(%r13)
incq %rbx
jmp 0x775f5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant2.c
// Function: init_error_limit
LOCAL(void)
init_error_limit (j_decompress_ptr cinfo)
/* Allocate and fill in the error_limiter table */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  int * table;
  int in, out;

  table = (int *) (*cinfo->mem->alloc_small)
    ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int));
  table += MAXJSAMPLE;		/* so can index -MAXJSAMPLE .. +MAXJSAMPLE */
  cquantize->error_limiter = table;

#define STEPSIZE ((MAXJSAMPLE+1)/16)
  /* Map errors 1:1 up to +- MAXJSAMPLE/16 */
  out = 0;
  for (in = 0; in < STEPSIZE; in++, out++) {
    table[in] = out; table[-in] = -out;
  }
  /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */
  for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
    table[in] = out; table[-in] = -out;
  }
  /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */
  for (; in <= MAXJSAMPLE; in++) {
    table[in] = out; table[-in] = -out;
  }
#undef STEPSIZE
}

// Assembly:
pushq %rbx
movq 0x270(%rdi), %rbx
movq 0x8(%rdi), %rax
pushq $0x1
popq %rsi
movl $0x7fc, %edx            # imm = 0x7FC
callq *(%rax)
leaq 0x3fc(%rax), %rcx
movq %rcx, 0x50(%rbx)
xorl %edx, %edx
xorl %esi, %esi
cmpq $-0x10, %rdx
je 0x77b16
movl %esi, (%rcx,%rsi,4)
movl %edx, (%rcx,%rdx,4)
incq %rsi
decq %rdx
jmp 0x77b02
leaq 0x3bc(%rax), %rcx
pushq $0x10
popq %rdx
xorl %esi, %esi
cmpq $0x20, %rsi
je 0x77b46
movl %edx, 0x43c(%rax,%rsi,4)
movl %edx, %edi
negl %edi
movl %edi, (%rcx)
leal 0x10(%rsi), %edi
andl $0x1, %edi
addl %edi, %edx
incq %rsi
addq $-0x4, %rcx
jmp 0x77b22
movq %rax, %rcx
addq $0x33c, %rcx            # imm = 0x33C
xorl %edx, %edx
cmpq $0xd0, %rdx
je 0x77b75
movl $0x20, 0x4bc(%rax,%rdx,4)
movl $0xffffffe0, (%rcx)     # imm = 0xFFFFFFE0
incq %rdx
addq $-0x4, %rcx
jmp 0x77b52
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant2.c
// Function: prescan_quantize
METHODDEF(void)
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
		  JSAMPARRAY output_buf, int num_rows)
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  register JSAMPROW ptr;
  register histptr histp;
  register hist3d histogram = cquantize->histogram;
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;

  for (row = 0; row < num_rows; row++) {
    ptr = input_buf[row];
    for (col = width; col > 0; col--) {
      /* get pixel value and index into the histogram */
      histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
			 [GETJSAMPLE(ptr[1]) >> C1_SHIFT]
			 [GETJSAMPLE(ptr[2]) >> C2_SHIFT];
      /* increment, check for overflow and undo increment if so. */
      if (++(*histp) <= 0)
	(*histp)--;
      ptr += 3;
    }
  }
}

// Assembly:
pushq %rbp
pushq %rbx
movq 0x270(%rdi), %rax
movq 0x30(%rax), %rax
movl 0x88(%rdi), %edx
xorl %edi, %edi
testl %ecx, %ecx
cmovlel %edi, %ecx
cmpq %rcx, %rdi
je 0x77be3
movq (%rsi,%rdi,8), %r8
movl %edx, %r9d
subl $0x1, %r9d
jb 0x77bde
movzbl (%r8), %r10d
andl $-0x8, %r10d
movzbl 0x1(%r8), %r11d
movzbl 0x2(%r8), %ebx
shll $0x4, %r11d
andl $-0x40, %r11d
addq (%rax,%r10), %r11
shrl $0x3, %ebx
movzwl (%r11,%rbx,2), %r10d
movl %r10d, %ebp
incw %bp
cmovel %r10d, %ebp
movw %bp, (%r11,%rbx,2)
addq $0x3, %r8
jmp 0x77b9d
incq %rdi
jmp 0x77b91
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant2.c
// Function: pass2_no_dither
METHODDEF(void)
pass2_no_dither (j_decompress_ptr cinfo,
		 JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
/* This version performs no dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  hist3d histogram = cquantize->histogram;
  register JSAMPROW inptr, outptr;
  register histptr cachep;
  register int c0, c1, c2;
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;

  for (row = 0; row < num_rows; row++) {
    inptr = input_buf[row];
    outptr = output_buf[row];
    for (col = width; col > 0; col--) {
      /* get pixel value and index into the cache */
      c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT;
      c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT;
      c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT;
      cachep = & histogram[c0][c1][c2];
      /* If we have not seen this color before, find nearest colormap entry */
      /* and update the cache */
      if (*cachep == 0)
	fill_inverse_cmap(cinfo, c0,c1,c2);
      /* Now emit the colormap index for this cell */
      *outptr++ = (JSAMPLE) (*cachep - 1);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, (%rsp)
movq 0x270(%rdi), %rax
movq 0x30(%rax), %r13
movq %rdi, 0x20(%rsp)
movl 0x88(%rdi), %ebp
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
movq %rcx, 0x10(%rsp)
cmpq 0x10(%rsp), %rdx
je 0x78393
movq (%rsp), %rax
movq (%rax,%rdx,8), %r15
movq 0x8(%rsp), %rax
movq %rdx, 0x18(%rsp)
movq (%rax,%rdx,8), %rbx
xorl %r14d, %r14d
cmpl %r14d, %ebp
je 0x78386
movzbl (%r15), %eax
movzbl 0x1(%r15), %edx
shrl $0x2, %edx
movzbl 0x2(%r15), %ecx
shrl $0x3, %ecx
movl %eax, %edi
andl $-0x8, %edi
movl %edx, %esi
shll $0x6, %esi
addq (%r13,%rdi), %rsi
movzwl (%rsi,%rcx,2), %edi
testw %di, %di
jne 0x78376
shrl $0x3, %eax
leaq (%rsi,%rcx,2), %r12
movzbl %cl, %ecx
movzbl %dl, %edx
movzbl %al, %esi
movq 0x20(%rsp), %rdi
callq 0x78756
movzwl (%r12), %edi
decb %dil
movb %dil, (%rbx,%r14)
incq %r14
addq $0x3, %r15
jmp 0x78326
movq 0x18(%rsp), %rdx
incq %rdx
jmp 0x78302
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdmerge.c
// Function: merged_2v_upsample
METHODDEF(void)
merged_2v_upsample (j_decompress_ptr cinfo,
		    JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
		    JDIMENSION in_row_groups_avail,
		    JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
		    JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
  JSAMPROW work_ptrs[2];
  JDIMENSION num_rows;		/* number of rows returned to caller */

  if (upsample->spare_full) {
    /* If we have a spare row saved from a previous cycle, just return it. */
    jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
		      1, upsample->out_row_width);
    num_rows = 1;
    upsample->spare_full = FALSE;
  } else {
    /* Figure number of rows to return to caller. */
    num_rows = 2;
    /* Not more than the distance to the end of the image. */
    if (num_rows > upsample->rows_to_go)
      num_rows = upsample->rows_to_go;
    /* And not more than what the client can accept: */
    out_rows_avail -= *out_row_ctr;
    if (num_rows > out_rows_avail)
      num_rows = out_rows_avail;
    /* Create output pointer array for upsampler. */
    work_ptrs[0] = output_buf[*out_row_ctr];
    if (num_rows > 1) {
      work_ptrs[1] = output_buf[*out_row_ctr + 1];
    } else {
      work_ptrs[1] = upsample->spare_row;
      upsample->spare_full = TRUE;
    }
    /* Now do the upsampling. */
    (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs);
  }

  /* Adjust counts */
  *out_row_ctr += num_rows;
  upsample->rows_to_go -= num_rows;
  /* When the buffer is emptied, declare this input row group consumed */
  if (! upsample->spare_full)
    (*in_row_group_ctr)++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movq %rdx, %rbx
movq 0x260(%rdi), %r15
cmpl $0x0, 0x48(%r15)
je 0x78ced
leaq 0x40(%r15), %rdi
movl (%r14), %eax
leaq (%r8,%rax,8), %rdx
movl 0x4c(%r15), %r9d
pushq $0x1
popq %rbp
xorl %esi, %esi
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x79173
andl $0x0, 0x48(%r15)
jmp 0x78d33
movl 0x40(%rsp), %ecx
movl 0x50(%r15), %edx
movl (%r14), %eax
subl %eax, %ecx
cmpl %ecx, %edx
cmovbl %edx, %ecx
movq (%r8,%rax,8), %rdx
movq %rdx, (%rsp)
pushq $0x2
popq %rbp
cmpl $0x2, %ecx
cmovbl %ecx, %ebp
jb 0x78d1a
incl %eax
movq (%r8,%rax,8), %rax
jmp 0x78d26
movq 0x40(%r15), %rax
movl $0x1, 0x48(%r15)
movq %rsp, %rcx
movq %rax, 0x8(%rcx)
movl (%rbx), %edx
callq *0x18(%r15)
addl %ebp, (%r14)
subl %ebp, 0x50(%r15)
cmpl $0x0, 0x48(%r15)
jne 0x78d43
incl (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jcomapi.c
// Function: jpeg_destroy
GLOBAL(void)
jpeg_destroy (j_common_ptr cinfo)
{
  /* We need only tell the memory manager to release everything. */
  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
  if (cinfo->mem != NULL)
    (*cinfo->mem->self_destruct) (cinfo);
  cinfo->mem = NULL;		/* be safe if jpeg_destroy is called twice */
  cinfo->global_state = 0;	/* mark it destroyed */
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x79116
movq %rbx, %rdi
callq *0x50(%rax)
andq $0x0, 0x8(%rbx)
andl $0x0, 0x24(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jerror.c
// Function: emit_message
METHODDEF(void)
emit_message (j_common_ptr cinfo, int msg_level)
{
  struct jpeg_error_mgr * err = cinfo->err;

  if (msg_level < 0) {
    /* It's a warning message.  Since corrupt files may generate many warnings,
     * the policy implemented here is to show only the first warning,
     * unless trace_level >= 3.
     */
    if (err->num_warnings == 0 || err->trace_level >= 3)
      (*err->output_message) (cinfo);
    /* Always count warnings in num_warnings. */
    err->num_warnings++;
  } else {
    /* It's a trace message.  Show it if trace_level >= msg_level. */
    if (err->trace_level >= msg_level)
      (*err->output_message) (cinfo);
  }
}

// Assembly:
movq (%rdi), %rcx
testl %esi, %esi
js 0x7926b
cmpl %esi, 0x7c(%rcx)
jge 0x7929a
retq
pushq %rbx
movq 0x80(%rcx), %rax
testq %rax, %rax
je 0x7927e
cmpl $0x3, 0x7c(%rcx)
jl 0x7928e
movq %rcx, %rbx
callq *0x10(%rcx)
movq %rbx, %rcx
movq 0x80(%rbx), %rax
incq %rax
movq %rax, 0x80(%rcx)
popq %rbx
retq
jmpq *0x10(%rcx)
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jerror.c
// Function: format_message
METHODDEF(void)
format_message (j_common_ptr cinfo, char * buffer)
{
  struct jpeg_error_mgr * err = cinfo->err;
  int msg_code = err->msg_code;
  const char * msgtext = NULL;
  const char * msgptr;
  char ch;
  jboolean isstring;

  /* Look up message string in proper table */
  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
    msgtext = err->jpeg_message_table[msg_code];
  } else if (err->addon_message_table != NULL &&
	     msg_code >= err->first_addon_message &&
	     msg_code <= err->last_addon_message) {
    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
  }

  /* Defend against bogus message number */
  if (msgtext == NULL) {
    err->msg_parm.i[0] = msg_code;
    msgtext = err->jpeg_message_table[0];
  }

  /* Check for string parameter, as indicated by %s in the message text */
  isstring = FALSE;
  msgptr = msgtext;
  while ((ch = *msgptr++) != '\0') {
    if (ch == '%') {
      if (*msgptr == 's') isstring = TRUE;
      break;
    }
  }

  /* Format the message into the passed buffer */
  if (isstring)
    sprintf(buffer, msgtext, err->msg_parm.s);
  else
    sprintf(buffer, msgtext,
	    err->msg_parm.i[0], err->msg_parm.i[1],
	    err->msg_parm.i[2], err->msg_parm.i[3],
	    err->msg_parm.i[4], err->msg_parm.i[5],
	    err->msg_parm.i[6], err->msg_parm.i[7]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq (%rdi), %rdx
movslq 0x28(%rdx), %rcx
testq %rcx, %rcx
jle 0x792f1
cmpl 0x90(%rdx), %ecx
jle 0x79318
movq 0x98(%rdx), %rsi
testq %rsi, %rsi
je 0x7932e
movl %ecx, %edi
subl 0xa0(%rdx), %edi
jl 0x7932e
cmpl 0xa4(%rdx), %ecx
jg 0x7932e
movslq %edi, %rdi
leaq (%rsi,%rdi,8), %rsi
jmp 0x79326
movq %rcx, %rsi
shlq $0x3, %rsi
addq 0x88(%rdx), %rsi
movq (%rsi), %rsi
testq %rsi, %rsi
jne 0x7933b
movl %ecx, 0x2c(%rdx)
movq 0x88(%rdx), %rcx
movq (%rcx), %rsi
movq %rsi, %rcx
movzbl (%rcx), %edi
testl %edi, %edi
je 0x79365
incq %rcx
cmpl $0x25, %edi
jne 0x7933e
cmpb $0x73, (%rcx)
jne 0x79365
addq $0x2c, %rdx
movq %rax, %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xe0e0
movl 0x2c(%rdx), %r10d
movl 0x30(%rdx), %ecx
movl 0x34(%rdx), %r8d
movl 0x38(%rdx), %r9d
movl 0x3c(%rdx), %r11d
movl 0x40(%rdx), %ebx
movl 0x44(%rdx), %r14d
movl 0x48(%rdx), %r15d
movq %rax, %rdi
movl %r10d, %edx
xorl %eax, %eax
pushq %r15
pushq %r14
pushq %rbx
pushq %r11
callq 0xe0e0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jmemmgr.c
// Function: alloc_large
METHODDEF(void FAR *)
alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
/* Allocate a "large" object */
{
  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
  large_pool_ptr hdr_ptr;
  size_t odd_bytes;

  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)))
    out_of_memory(cinfo, 3);	/* request exceeds malloc's ability */

  /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
  odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);
  if (odd_bytes > 0)
    sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;

  /* Always make a new pool */
  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */

  hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject +
					    SIZEOF(large_pool_hdr));
  if (hdr_ptr == NULL)
    out_of_memory(cinfo, 4);	/* jpeg_get_large failed */
  mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr);

  /* Success, initialize the new pool header and add to list */
  hdr_ptr->hdr.next = mem->large_list[pool_id];
  /* We maintain space counts in each pool header for statistical purposes,
   * even though they are not needed for allocation.
   */
  hdr_ptr->hdr.bytes_used = sizeofobject;
  hdr_ptr->hdr.bytes_left = 0;
  mem->large_list[pool_id] = hdr_ptr;

  return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rdi), %r13
cmpq $0x3b9ac9e9, %rdx       # imm = 0x3B9AC9E9
jb 0x7969e
movq (%r14), %rax
movabsq $0x300000036, %rcx      # imm = 0x300000036
movq %rcx, 0x28(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
addq $0x7, %rbx
andq $-0x8, %rbx
cmpl $0x2, %ebp
jb 0x796c0
movq (%r14), %rax
movl $0xe, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
leaq 0x18(%rbx), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x7a120
movq %rax, %r15
testq %rax, %rax
jne 0x796f0
movq (%r14), %rax
movabsq $0x400000036, %rcx      # imm = 0x400000036
movq %rcx, 0x28(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
addq %r12, 0x98(%r13)
movslq %ebp, %rax
movq 0x78(%r13,%rax,8), %rcx
movq %rcx, (%r15)
movq %rbx, 0x8(%r15)
andq $0x0, 0x10(%r15)
movq %r15, 0x78(%r13,%rax,8)
addq $0x18, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jmemmgr.c
// Function: alloc_sarray
METHODDEF(JSAMPARRAY)
alloc_sarray (j_common_ptr cinfo, int pool_id,
	      JDIMENSION samplesperrow, JDIMENSION numrows)
/* Allocate a 2-D sample array */
{
  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
  JSAMPARRAY result;
  JSAMPROW workspace;
  JDIMENSION rowsperchunk, currow, i;
  long ltemp;

  /* Calculate max # of rows allowed in one allocation chunk */
  ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
	  ((long) samplesperrow * SIZEOF(JSAMPLE));
  if (ltemp <= 0)
    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  if (ltemp < (long) numrows)
    rowsperchunk = (JDIMENSION) ltemp;
  else
    rowsperchunk = numrows;
  mem->last_rowsperchunk = rowsperchunk;

  /* Get space for row pointers (small object) */
  result = (JSAMPARRAY) alloc_small(cinfo, pool_id,
				    (size_t) (numrows * SIZEOF(JSAMPROW)));

  /* Get the rows themselves (large objects) */
  currow = 0;
  while (currow < numrows) {
    rowsperchunk = MIN(rowsperchunk, numrows - currow);
    workspace = (JSAMPROW) alloc_large(cinfo, pool_id,
	(size_t) ((size_t) rowsperchunk * (size_t) samplesperrow
		  * SIZEOF(JSAMPLE)));
    for (i = rowsperchunk; i > 0; i--) {
      result[currow++] = workspace;
      workspace += samplesperrow;
    }
  }

  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, 0x4(%rsp)
movl %edx, %ecx
movl %esi, (%rsp)
movq %rdi, %r15
movq 0x8(%rdi), %r14
movl %edx, %r13d
xorl %ebp, %ebp
movl $0x3b9ac9e8, %eax       # imm = 0x3B9AC9E8
xorl %edx, %edx
divl %ecx
movl %eax, %r12d
cmpl $0x3b9ac9e9, %ecx       # imm = 0x3B9AC9E9
jb 0x79769
movq (%r15), %rax
movl $0x46, 0x28(%rax)
movq %r15, %rdi
callq *(%rax)
movl 0x4(%rsp), %eax
movl %eax, %edx
cmpl %eax, %r12d
cmovael %eax, %r12d
movl %r12d, 0xa0(%r14)
shlq $0x3, %rdx
movq %r15, %rbx
movq %r15, %rdi
movl (%rsp), %esi
callq 0x79518
movq %rax, %r15
movl 0x4(%rsp), %eax
movl %eax, %r14d
subl %ebp, %r14d
jbe 0x797d1
cmpl %r14d, %r12d
cmovbl %r12d, %r14d
movq %r14, %rdx
imulq %r13, %rdx
movq %rbx, %rdi
movl (%rsp), %esi
callq 0x79665
movl %r14d, %ecx
subl $0x1, %ecx
jb 0x797cc
movl %ebp, %edx
incl %ebp
movq %rax, (%r15,%rdx,8)
addq %r13, %rax
jmp 0x797ba
movl %r14d, %r12d
jmp 0x79792
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jmemmgr.c
// Function: alloc_barray
METHODDEF(JBLOCKARRAY)
alloc_barray (j_common_ptr cinfo, int pool_id,
	      JDIMENSION blocksperrow, JDIMENSION numrows)
/* Allocate a 2-D coefficient-block array */
{
  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
  JBLOCKARRAY result;
  JBLOCKROW workspace;
  JDIMENSION rowsperchunk, currow, i;
  long ltemp;

  /* Calculate max # of rows allowed in one allocation chunk */
  ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
	  ((long) blocksperrow * SIZEOF(JBLOCK));
  if (ltemp <= 0)
    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  if (ltemp < (long) numrows)
    rowsperchunk = (JDIMENSION) ltemp;
  else
    rowsperchunk = numrows;
  mem->last_rowsperchunk = rowsperchunk;

  /* Get space for row pointers (small object) */
  result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,
				     (size_t) (numrows * SIZEOF(JBLOCKROW)));

  /* Get the rows themselves (large objects) */
  currow = 0;
  while (currow < numrows) {
    rowsperchunk = MIN(rowsperchunk, numrows - currow);
    workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,
	(size_t) ((size_t) rowsperchunk * (size_t) blocksperrow
		  * SIZEOF(JBLOCK)));
    for (i = rowsperchunk; i > 0; i--) {
      result[currow++] = workspace;
      workspace += blocksperrow;
    }
  }

  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, 0x4(%rsp)
movl %edx, %ecx
movl %esi, (%rsp)
movq %rdi, %r14
movq 0x8(%rdi), %r15
movl %edx, %r13d
shlq $0x7, %r13
xorl %ebp, %ebp
movl $0x3b9ac9e8, %eax       # imm = 0x3B9AC9E8
xorl %edx, %edx
divq %r13
movq %rax, %rbx
cmpl $0x773594, %ecx         # imm = 0x773594
jb 0x7982b
movq (%r14), %rax
movl $0x46, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
movl 0x4(%rsp), %eax
movl %eax, %edx
cmpq %rdx, %rbx
cmovael %eax, %ebx
movl %ebx, 0xa0(%r15)
shlq $0x3, %rdx
movq %r14, %rdi
movl (%rsp), %esi
callq 0x79518
movq %rax, %r15
movl 0x4(%rsp), %eax
movl %eax, %r12d
subl %ebp, %r12d
jbe 0x7988f
cmpl %r12d, %ebx
cmovbl %ebx, %r12d
movq %r13, %rdx
imulq %r12, %rdx
movq %r14, %rdi
movl (%rsp), %esi
callq 0x79665
movl %r12d, %ecx
subl $0x1, %ecx
jb 0x7988a
movl %ebp, %edx
incl %ebp
movq %rax, (%r15,%rdx,8)
addq %r13, %rax
jmp 0x79878
movl %r12d, %ebx
jmp 0x79850
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jmemmgr.c
// Function: request_virt_sarray
METHODDEF(jvirt_sarray_ptr)
request_virt_sarray (j_common_ptr cinfo, int pool_id, jboolean pre_zero,
		     JDIMENSION samplesperrow, JDIMENSION numrows,
		     JDIMENSION maxaccess)
/* Request a virtual 2-D sample array */
{
  my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
  jvirt_sarray_ptr result;

  /* Only IMAGE-lifetime virtual arrays are currently supported */
  if (pool_id != JPOOL_IMAGE)
    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id);	/* safety check */

  /* get control block */
  result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id,
					  SIZEOF(struct jvirt_sarray_control));

  result->mem_buffer = NULL;	/* marks array not yet realized */
  result->rows_in_array = numrows;
  result->samplesperrow = samplesperrow;
  result->maxaccess = maxaccess;
  result->pre_zero = pre_zero;
  result->b_s_open = FALSE;	/* no associated backing-store object */
  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  mem->virt_sarray_list = result;

  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %r8d, %r15d
movl %ecx, %r14d
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r13
movq 0x8(%rdi), %rbx
cmpl $0x1, %esi
je 0x798e0
movq (%r13), %rax
movl $0xe, 0x28(%rax)
movl %r12d, 0x2c(%rax)
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
movl $0x98, %edx
movq %r13, %rdi
movl %r12d, %esi
callq 0x79518
andq $0x0, (%rax)
movl %r15d, 0x8(%rax)
movl %r14d, 0xc(%rax)
movl 0x4(%rsp), %ecx
movl %ecx, 0x10(%rax)
movl %ebp, 0x24(%rax)
andl $0x0, 0x2c(%rax)
movq 0x88(%rbx), %rcx
movq %rcx, 0x30(%rax)
movq %rax, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jmemmgr.c
// Function: self_destruct
METHODDEF(void)
self_destruct (j_common_ptr cinfo)
{
  int pool;

  /* Close all backing store, release all memory.
   * Releasing pools in reverse order might help avoid fragmentation
   * with some (brain-damaged) malloc libraries.
   */
  for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
    free_pool(cinfo, pool);
  }

  /* Release the memory manager control block too. */
  jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr));
  cinfo->mem = NULL;		/* ensures I will be called only once */

  jpeg_mem_term(cinfo);		/* system-dependent cleanup */
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %rbp
testl %ebp, %ebp
js 0x79f8d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x79e4b
decl %ebp
jmp 0x79f7b
movq 0x8(%rbx), %rsi
movl $0xa8, %edx
movq %rbx, %rdi
callq 0x7a118
andq $0x0, 0x8(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x7a143