LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdatadst.c
// Function: empty_output_buffer
METHODDEF(jboolean)
empty_output_buffer (j_compress_ptr cinfo)
{
  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;

  if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
      (size_t) OUTPUT_BUF_SIZE)
    ERREXIT(cinfo, JERR_FILE_WRITE);

  dest->pub.next_output_byte = dest->buffer;
  dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;

  return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %r14
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rdi
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0xe8b0
cmpq $0x1000, %rax           # imm = 0x1000
je 0x73c6d
movq (%rbx), %rax
movl $0x25, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movq 0x30(%r14), %rax
movq %rax, (%r14)
movq $0x1000, 0x8(%r14)      # imm = 0x1000
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdatadst.c
// Function: term_destination
METHODDEF(void)
term_destination (j_compress_ptr cinfo)
{
  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
  size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;

  /* Write any data remaining in the buffer */
  if (datacount > 0) {
    if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
      ERREXIT(cinfo, JERR_FILE_WRITE);
  }
  fflush(dest->outfile);
  /* Make sure we wrote the output file OK */
  if (ferror(dest->outfile))
    ERREXIT(cinfo, JERR_FILE_WRITE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %r15
movq 0x8(%r15), %rax
cmpq $0x1000, %rax           # imm = 0x1000
je 0x73cd3
movl $0x1000, %r14d          # imm = 0x1000
subq %rax, %r14
movq 0x28(%r15), %rcx
movq 0x30(%r15), %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0xe8b0
cmpq %r14, %rax
je 0x73cd3
movq (%rbx), %rax
movl $0x25, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movq 0x28(%r15), %rdi
callq 0xe520
movq 0x28(%r15), %rdi
callq 0xe870
testl %eax, %eax
je 0x73cfd
movq (%rbx), %rax
movl $0x25, 0x28(%rax)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmpq *(%rax)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcinit.c
// Function: jinit_compress_master
GLOBAL(void)
jinit_compress_master (j_compress_ptr cinfo)
{
  /* Initialize master control (includes parameter checking/processing) */
  jinit_c_master_control(cinfo, FALSE /* full compression */);

  /* Preprocessing */
  if (! cinfo->raw_data_in) {
    jinit_color_converter(cinfo);
    jinit_downsampler(cinfo);
    jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
  }
  /* Forward DCT */
  jinit_forward_dct(cinfo);
  /* Entropy encoding: either Huffman or arithmetic coding. */
  if (cinfo->arith_code) {
    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  } else {
    if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED
      jinit_phuff_encoder(cinfo);
#else
      ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif
    } else
      jinit_huff_encoder(cinfo);
  }

  /* Need a full-image coefficient buffer in any multi-pass mode. */
  jinit_c_coef_controller(cinfo,
		(jboolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
  jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);

  jinit_marker_writer(cinfo);

  /* We can now tell the memory manager to allocate virtual arrays. */
  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);

  /* Write the datastream header (SOI) immediately.
   * Frame and scan headers are postponed till later.
   * This lets application insert special markers after the SOI.
   */
  (*cinfo->marker->write_file_header) (cinfo);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %esi, %esi
callq 0x73dbc
cmpl $0x0, 0x100(%rbx)
jne 0x73d32
movq %rbx, %rdi
callq 0x76a90
movq %rbx, %rdi
callq 0x77048
movq %rbx, %rdi
xorl %esi, %esi
callq 0x755e4
movq %rbx, %rdi
callq 0x79e50
cmpl $0x0, 0x104(%rbx)
je 0x73d54
movq (%rbx), %rax
movl $0x1, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
jmp 0x73d6f
cmpl $0x0, 0x134(%rbx)
je 0x73d67
movq %rbx, %rdi
callq 0x78e48
jmp 0x73d6f
movq %rbx, %rdi
callq 0x77ed4
movl $0x1, %esi
cmpl $0x1, 0xf0(%rbx)
jg 0x73d8a
xorl %esi, %esi
cmpl $0x0, 0x108(%rbx)
setne %sil
movq %rbx, %rdi
callq 0x75d04
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7543c
movq %rbx, %rdi
callq 0x749dc
movq 0x8(%rbx), %rax
movq %rbx, %rdi
callq *0x30(%rax)
movq 0x1d0(%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *(%rax)
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmaster.c
// Function: select_scan_parameters
LOCAL(void)
select_scan_parameters (j_compress_ptr cinfo)
/* Set up the scan parameters for the current scan */
{
  int ci;

#ifdef C_MULTISCAN_FILES_SUPPORTED
  if (cinfo->scan_info != NULL) {
    /* Prepare for current scan --- the script is already validated */
    my_master_ptr master = (my_master_ptr) cinfo->master;
    const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;

    cinfo->comps_in_scan = scanptr->comps_in_scan;
    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
      cinfo->cur_comp_info[ci] =
	&cinfo->comp_info[scanptr->component_index[ci]];
    }
    cinfo->Ss = scanptr->Ss;
    cinfo->Se = scanptr->Se;
    cinfo->Ah = scanptr->Ah;
    cinfo->Al = scanptr->Al;
  }
  else
#endif
  {
    /* Prepare for single sequential-JPEG scan containing all components */
    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
	       MAX_COMPS_IN_SCAN);
    cinfo->comps_in_scan = cinfo->num_components;
    for (ci = 0; ci < cinfo->num_components; ci++) {
      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
    }
    cinfo->Ss = 0;
    cinfo->Se = DCTSIZE2-1;
    cinfo->Ah = 0;
    cinfo->Al = 0;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0xf8(%rdi), %rax
testq %rax, %rax
je 0x74743
movq 0x1b0(%rbx), %rcx
movslq 0x2c(%rcx), %rcx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rax
movslq (%rax), %rcx
movl %ecx, 0x144(%rbx)
testq %rcx, %rcx
jle 0x74727
movq 0x58(%rbx), %rdx
xorl %esi, %esi
movslq 0x4(%rax,%rsi,4), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x5, %rdi
addq %rdx, %rdi
movq %rdi, 0x148(%rbx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x74707
movq 0x14(%rax), %rcx
movq %rcx, 0x19c(%rbx)
movl 0x1c(%rax), %ecx
movl %ecx, 0x1a4(%rbx)
movl 0x20(%rax), %eax
jmp 0x7483e
movl 0x4c(%rbx), %eax
cmpl $0x5, %eax
jl 0x7476a
movq (%rbx), %rcx
movl $0x1a, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movl $0x4, 0x30(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movslq 0x4c(%rbx), %rdx
movl %edx, 0x144(%rbx)
testq %rdx, %rdx
jle 0x74821
movq 0x58(%rbx), %rax
leal 0x1(%rdx), %ecx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %ecx
shlq $0x4, %rcx
movdqa 0x2dae1(%rip), %xmm1    # 0xa2280
xorl %edx, %edx
movdqa 0x2dae7(%rip), %xmm2    # 0xa2290
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x2dae7(%rip), %xmm4    # 0xa22a0
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0x747f3
movq %rax, 0x148(%rbx,%rdx)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x7480e
leaq 0x60(%rax), %rsi
movq %rsi, 0x150(%rbx,%rdx)
paddq %xmm4, %xmm1
addq $0x10, %rdx
addq $0xc0, %rax
cmpq %rdx, %rcx
jne 0x747b9
movabsq $0x3f00000000, %rax     # imm = 0x3F00000000
movq %rax, 0x19c(%rbx)
movl $0x0, 0x1a4(%rbx)
xorl %eax, %eax
movl %eax, 0x1a8(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: jinit_marker_writer
GLOBAL(void)
jinit_marker_writer (j_compress_ptr cinfo)
{
  my_marker_ptr marker;

  /* Create the subobject */
  marker = (my_marker_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_marker_writer));
  cinfo->marker = (struct jpeg_marker_writer *) marker;
  /* Initialize method pointers */
  marker->pub.write_file_header = write_file_header;
  marker->pub.write_frame_header = write_frame_header;
  marker->pub.write_scan_header = write_scan_header;
  marker->pub.write_file_trailer = write_file_trailer;
  marker->pub.write_tables_only = write_tables_only;
  marker->pub.write_marker_header = write_marker_header;
  marker->pub.write_marker_byte = write_marker_byte;
  /* Initialize private state */
  marker->last_restart_interval = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movl $0x40, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, 0x1d0(%rbx)
leaq 0x4e(%rip), %rcx        # 0x74a4c
movq %rcx, (%rax)
leaq 0x26c(%rip), %rcx       # 0x74c74
movq %rcx, 0x8(%rax)
leaq 0x346(%rip), %rcx       # 0x74d59
movq %rcx, 0x10(%rax)
leaq 0x533(%rip), %rcx       # 0x74f51
movq %rcx, 0x18(%rax)
leaq 0x544(%rip), %rcx       # 0x74f6d
movq %rcx, 0x20(%rax)
leaq 0x5dc(%rip), %rcx       # 0x75010
movq %rcx, 0x28(%rax)
leaq 0x63a(%rip), %rcx       # 0x75079
movq %rcx, 0x30(%rax)
movl $0x0, 0x38(%rax)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: write_file_header
METHODDEF(void)
write_file_header (j_compress_ptr cinfo)
{
  my_marker_ptr marker = (my_marker_ptr) cinfo->marker;

  emit_marker(cinfo, M_SOI);	/* first the SOI */

  /* SOI is defined to reset restart interval to 0 */
  marker->last_restart_interval = 0;

  if (cinfo->write_JFIF_header)	/* next an optional JFIF APP0 */
    emit_jfif_app0(cinfo);
  if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
    emit_adobe_app14(cinfo);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1d0(%rdi), %r15
movl $0xff, %r14d
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xd8, %esi
callq 0x7507b
movl $0x0, 0x38(%r15)
cmpl $0x0, 0x120(%rbx)
je 0x74b81
movq %rbx, %rdi
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xe0, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x10, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x4a, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x46, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x49, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x46, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movzbl 0x124(%rbx), %esi
movq %rbx, %rdi
callq 0x7507b
movzbl 0x125(%rbx), %esi
movq %rbx, %rdi
callq 0x7507b
movzbl 0x126(%rbx), %esi
movq %rbx, %rdi
callq 0x7507b
movzwl 0x128(%rbx), %ebp
movl %ebp, %esi
shrl $0x8, %esi
movq %rbx, %rdi
callq 0x7507b
andl %r14d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
movzwl 0x12a(%rbx), %ebp
movl %ebp, %esi
shrl $0x8, %esi
movq %rbx, %rdi
callq 0x7507b
andl %r14d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
cmpl $0x0, 0x12c(%rbx)
je 0x74c69
movq %rbx, %rdi
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xee, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xe, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x41, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x64, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x6f, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x62, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x65, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0x64, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movl 0x50(%rbx), %eax
xorl %ecx, %ecx
cmpl $0x5, %eax
sete %cl
addl %ecx, %ecx
cmpl $0x3, %eax
movl $0x1, %esi
cmovnel %ecx, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x7507b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: write_frame_header
METHODDEF(void)
write_frame_header (j_compress_ptr cinfo)
{
  int ci, prec;
  jboolean is_baseline;
  jpeg_component_info *compptr;
  
  /* Emit DQT for each quantization table.
   * Note that emit_dqt() suppresses any duplicate tables.
   */
  prec = 0;
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    prec += emit_dqt(cinfo, compptr->quant_tbl_no);
  }
  /* now prec is nonzero iff there are any 16-bit quant tables. */

  /* Check for a non-baseline specification.
   * Note we assume that Huffman table numbers won't be changed later.
   */
  if (cinfo->arith_code || cinfo->progressive_mode ||
      cinfo->data_precision != 8) {
    is_baseline = FALSE;
  } else {
    is_baseline = TRUE;
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
	is_baseline = FALSE;
    }
    if (prec && is_baseline) {
      is_baseline = FALSE;
      /* If it's baseline except for quantizer size, warn the user */
      TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
    }
  }

  /* Emit the proper SOF marker */
  if (cinfo->arith_code) {
    emit_sof(cinfo, M_SOF9);	/* SOF code for arithmetic coding */
  } else {
    if (cinfo->progressive_mode)
      emit_sof(cinfo, M_SOF2);	/* SOF code for progressive Huffman */
    else if (is_baseline)
      emit_sof(cinfo, M_SOF0);	/* SOF code for baseline implementation */
    else
      emit_sof(cinfo, M_SOF1);	/* SOF code for non-baseline Huffman file */
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x4c(%rdi), %eax
xorl %ebp, %ebp
testl %eax, %eax
jle 0x74cbb
movq 0x58(%rbx), %r14
addq $0x10, %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movl (%r14), %esi
movq %rbx, %rdi
callq 0x750af
addl %eax, %r15d
incl %r12d
movl 0x4c(%rbx), %eax
addq $0x60, %r14
cmpl %eax, %r12d
jl 0x74c96
testl %r15d, %r15d
setne %cl
jmp 0x74cbd
xorl %ecx, %ecx
cmpl $0x0, 0x104(%rbx)
jne 0x74d22
cmpl $0x0, 0x134(%rbx)
jne 0x74d22
cmpl $0x8, 0x48(%rbx)
jne 0x74d22
testl %eax, %eax
jle 0x74cfd
movq 0x58(%rbx), %rdx
addq $0x18, %rdx
movl $0x1, %ebp
cmpl $0x1, -0x4(%rdx)
jg 0x74cf1
cmpl $0x2, (%rdx)
jl 0x74cf3
xorl %ebp, %ebp
addq $0x60, %rdx
decl %eax
jne 0x74ce6
jmp 0x74d02
movl $0x1, %ebp
testl %ebp, %ebp
setne %al
andb %al, %cl
cmpb $0x1, %cl
jne 0x74d22
movq (%rbx), %rax
movl $0x4b, 0x28(%rax)
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq *0x8(%rax)
movl $0xc9, %esi
cmpl $0x0, 0x104(%rbx)
jne 0x74d49
movl $0xc2, %esi
cmpl $0x0, 0x134(%rbx)
jne 0x74d49
xorl %esi, %esi
cmpl $0x1, %ebp
adcl $0xc0, %esi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x751ec
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: write_tables_only
METHODDEF(void)
write_tables_only (j_compress_ptr cinfo)
{
  int i;

  emit_marker(cinfo, M_SOI);

  for (i = 0; i < NUM_QUANT_TBLS; i++) {
    if (cinfo->quant_tbl_ptrs[i] != NULL)
      (void) emit_dqt(cinfo, i);
  }

  if (! cinfo->arith_code) {
    for (i = 0; i < NUM_HUFF_TBLS; i++) {
      if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
	emit_dht(cinfo, i, FALSE);
      if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
	emit_dht(cinfo, i, TRUE);
    }
  }

  emit_marker(cinfo, M_EOI);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xd8, %esi
callq 0x7507b
xorl %r14d, %r14d
cmpq $0x0, 0x60(%rbx,%r14,8)
je 0x74fa1
movq %rbx, %rdi
movl %r14d, %esi
callq 0x750af
incq %r14
cmpq $0x4, %r14
jne 0x74f8e
cmpl $0x0, 0x104(%rbx)
jne 0x74ff2
xorl %r14d, %r14d
cmpq $0x0, 0x80(%rbx,%r14,8)
je 0x74fce
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x75302
cmpq $0x0, 0xa0(%rbx,%r14,8)
je 0x74fe9
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x75302
incq %r14
cmpq $0x4, %r14
jne 0x74fb6
movq %rbx, %rdi
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xd9, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7507b
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: write_marker_header
METHODDEF(void)
write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
/* Emit an arbitrary marker header */
{
  if (datalen > (unsigned int) 65533)		/* safety check */
    ERREXIT(cinfo, JERR_BAD_LENGTH);

  emit_marker(cinfo, (JPEG_MARKER) marker);

  emit_2bytes(cinfo, (int) (datalen + 2));	/* total length */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
cmpl $0xfffe, %edx           # imm = 0xFFFE
jb 0x75035
movq (%r14), %rax
movl $0xb, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
movl $0xff, %r15d
movq %r14, %rdi
movl $0xff, %esi
callq 0x7507b
movq %r14, %rdi
movl %ebp, %esi
callq 0x7507b
addl $0x2, %ebx
movl %ebx, %esi
shrl $0x8, %esi
andl %r15d, %esi
movq %r14, %rdi
callq 0x7507b
andl %r15d, %ebx
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x7507b
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: emit_byte
LOCAL(void)
emit_byte (j_compress_ptr cinfo, int val)
/* Emit a byte */
{
  struct jpeg_destination_mgr * dest = cinfo->dest;

  *(dest->next_output_byte)++ = (JOCTET) val;
  if (--dest->free_in_buffer == 0) {
    if (! (*dest->empty_output_buffer) (cinfo))
      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  }
}

// Assembly:
pushq %rbx
movq 0x28(%rdi), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
movb %sil, (%rcx)
decq 0x8(%rax)
jne 0x7509d
movq %rdi, %rbx
callq *0x18(%rax)
testl %eax, %eax
je 0x7509f
popq %rbx
retq
movq (%rbx), %rax
movl $0x18, 0x28(%rax)
movq %rbx, %rdi
popq %rbx
jmpq *(%rax)
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: emit_dqt
LOCAL(int)
emit_dqt (j_compress_ptr cinfo, int index)
/* Emit a DQT marker */
/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
{
  JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
  int prec;
  int i;

  if (qtbl == NULL)
    ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);

  prec = 0;
  for (i = 0; i < DCTSIZE2; i++) {
    if (qtbl->quantval[i] > 255)
      prec = 1;
  }

  if (! qtbl->sent_table) {
    emit_marker(cinfo, M_DQT);

    emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);

    emit_byte(cinfo, index + (prec<<4));

    for (i = 0; i < DCTSIZE2; i++) {
      /* The table entries must be emitted in zigzag order. */
      unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
      if (prec)
	emit_byte(cinfo, (int) (qval >> 8));
      emit_byte(cinfo, (int) (qval & 0xFF));
    }

    qtbl->sent_table = TRUE;
  }

  return prec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movslq %esi, %rax
movq 0x60(%rdi,%rax,8), %r12
testq %r12, %r12
jne 0x750e1
movq (%rbx), %rax
movl $0x34, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
pxor %xmm0, %xmm0
xorl %eax, %eax
movdqa 0x353e1(%rip), %xmm1    # 0xaa4d0
movdqa 0x353e9(%rip), %xmm2    # 0xaa4e0
punpcklwd %xmm2, %xmm2    # xmm2 = xmm2[0,0,1,1,2,2,3,3]
movq (%r12,%rax,2), %xmm3
punpcklwd %xmm3, %xmm3    # xmm3 = xmm3[0,0,1,1,2,2,3,3]
pxor %xmm1, %xmm3
pcmpgtw %xmm2, %xmm3
por %xmm3, %xmm0
addq $0x4, %rax
cmpq $0x40, %rax
jne 0x750fb
pslld $0x1f, %xmm0
movmskps %xmm0, %r13d
cmpl $0x0, 0x80(%r12)
jne 0x751d5
xorl %r14d, %r14d
testb %r13b, %r13b
setne %r14b
movq %rbx, %rdi
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xdb, %esi
callq 0x7507b
movl %r14d, %r15d
shll $0x6, %r15d
addl $0x43, %r15d
movl %ebp, 0x4(%rsp)
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7507b
movq %rbx, %rdi
movl %r15d, %esi
callq 0x7507b
shll $0x4, %r14d
addl 0x4(%rsp), %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x7507b
leaq 0x35ae8(%rip), %r14     # 0xaac80
movslq (%r14,%rbp,4), %rax
movzwl (%r12,%rax,2), %r15d
testb %r13b, %r13b
je 0x751b4
movl %r15d, %esi
shrl $0x8, %esi
movq %rbx, %rdi
callq 0x7507b
movzbl %r15b, %esi
movq %rbx, %rdi
callq 0x7507b
incq %rbp
cmpq $0x40, %rbp
jne 0x75198
movl $0x1, 0x80(%r12)
xorl %eax, %eax
testb %r13b, %r13b
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: emit_sof
LOCAL(void)
emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
/* Emit a SOF marker */
{
  int ci;
  jpeg_component_info *compptr;
  
  emit_marker(cinfo, code);
  
  emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */

  /* Make sure image isn't bigger than SOF field can handle */
  if ((long) cinfo->image_height > 65535L ||
      (long) cinfo->image_width > 65535L)
    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);

  emit_byte(cinfo, cinfo->data_precision);
  emit_2bytes(cinfo, (int) cinfo->image_height);
  emit_2bytes(cinfo, (int) cinfo->image_width);

  emit_byte(cinfo, cinfo->num_components);

  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    emit_byte(cinfo, compptr->component_id);
    emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
    emit_byte(cinfo, compptr->quant_tbl_no);
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl $0xff, %r14d
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
movl 0x4c(%rbx), %eax
leal (%rax,%rax,2), %ebp
addl $0x8, %ebp
movl %ebp, %esi
shrl $0x8, %esi
andl %r14d, %esi
movq %rbx, %rdi
callq 0x7507b
andl %r14d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
cmpl $0xffff, 0x34(%rbx)     # imm = 0xFFFF
ja 0x75247
cmpl $0x10000, 0x30(%rbx)    # imm = 0x10000
jb 0x75260
movq (%rbx), %rax
movabsq $0xffff00000029, %rcx   # imm = 0xFFFF00000029
movq %rcx, 0x28(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x48(%rbx), %esi
movq %rbx, %rdi
callq 0x7507b
movl 0x34(%rbx), %ebp
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r14d
andl %r14d, %esi
movq %rbx, %rdi
callq 0x7507b
andl %r14d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
movl 0x30(%rbx), %ebp
movl %ebp, %esi
shrl $0x8, %esi
andl %r14d, %esi
movq %rbx, %rdi
callq 0x7507b
andl %r14d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
movl 0x4c(%rbx), %esi
movq %rbx, %rdi
callq 0x7507b
cmpl $0x0, 0x4c(%rbx)
jle 0x752fd
movq 0x58(%rbx), %r14
xorl %ebp, %ebp
movl (%r14), %esi
movq %rbx, %rdi
callq 0x7507b
movl 0x8(%r14), %esi
shll $0x4, %esi
addl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x7507b
movl 0x10(%r14), %esi
movq %rbx, %rdi
callq 0x7507b
incl %ebp
addq $0x60, %r14
cmpl 0x4c(%rbx), %ebp
jl 0x752c8
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmarker.c
// Function: emit_dht
LOCAL(void)
emit_dht (j_compress_ptr cinfo, int index, jboolean is_ac)
/* Emit a DHT marker */
{
  JHUFF_TBL * htbl;
  int length, i;
  
  if (is_ac) {
    htbl = cinfo->ac_huff_tbl_ptrs[index];
    index += 0x10;		/* output index has AC bit set */
  } else {
    htbl = cinfo->dc_huff_tbl_ptrs[index];
  }

  if (htbl == NULL)
    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
  
  if (! htbl->sent_table) {
    emit_marker(cinfo, M_DHT);
    
    length = 0;
    for (i = 1; i <= 16; i++)
      length += htbl->bits[i];
    
    emit_2bytes(cinfo, length + 2 + 1 + 16);
    emit_byte(cinfo, index);
    
    for (i = 1; i <= 16; i++)
      emit_byte(cinfo, htbl->bits[i]);
    
    for (i = 0; i < length; i++)
      emit_byte(cinfo, htbl->huffval[i]);
    
    htbl->sent_table = TRUE;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leal 0x10(%rsi), %eax
testl %edx, %edx
movslq %esi, %r14
leaq 0xa0(%rdi,%r14,8), %rcx
leaq 0x80(%rdi,%r14,8), %rdx
cmovnel %eax, %r14d
cmovneq %rcx, %rdx
movq (%rdx), %r15
testq %r15, %r15
jne 0x7534e
movq (%rbx), %rax
movl $0x32, 0x28(%rax)
movl %r14d, 0x2c(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
cmpl $0x0, 0x114(%r15)
jne 0x7542d
movq %rbx, %rdi
movl $0xff, %esi
callq 0x7507b
movq %rbx, %rdi
movl $0xc4, %esi
callq 0x7507b
pxor %xmm0, %xmm0
xorl %eax, %eax
pxor %xmm1, %xmm1
movd 0x1(%r15,%rax), %xmm2
punpcklbw %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
paddd %xmm2, %xmm1
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x75380
pshufd $0xee, %xmm1, %xmm0     # xmm0 = xmm1[2,3,2,3]
paddd %xmm1, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %r12d
leal 0x13(%r12), %ebp
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r13d
andl %r13d, %esi
movq %rbx, %rdi
callq 0x7507b
andl %r13d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7507b
movq %rbx, %rdi
movl %r14d, %esi
callq 0x7507b
xorl %r14d, %r14d
movzbl 0x1(%r15,%r14), %esi
movq %rbx, %rdi
callq 0x7507b
incq %r14
cmpq $0x10, %r14
jne 0x753ea
testl %r12d, %r12d
je 0x75422
movl %r12d, %r14d
xorl %r12d, %r12d
movzbl 0x11(%r15,%r12), %esi
movq %rbx, %rdi
callq 0x7507b
incq %r12
cmpq %r12, %r14
jne 0x7540c
movl $0x1, 0x114(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmainct.c
// Function: jinit_c_main_controller
GLOBAL(void)
jinit_c_main_controller (j_compress_ptr cinfo, jboolean need_full_buffer)
{
  my_main_ptr mainp;
  int ci;
  jpeg_component_info *compptr;

  mainp = (my_main_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_main_controller));
  cinfo->main = (struct jpeg_c_main_controller *) mainp;
  mainp->pub.start_pass = start_pass_main;

  /* We don't need to create a buffer in raw-data mode. */
  if (cinfo->raw_data_in)
    return;

  /* Create the buffer.  It holds downsampled data, so each component
   * may be of a different size.
   */
  if (need_full_buffer) {
#ifdef FULL_MAIN_BUFFER_SUPPORTED
    /* Allocate a full-image virtual array for each component */
    /* Note we pad the bottom to a multiple of the iMCU height */
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      mainp->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
	 compptr->width_in_blocks * DCTSIZE,
	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
				(long) compptr->v_samp_factor) * DCTSIZE,
	 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
    }
#else
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
#endif
  } else {
#ifdef FULL_MAIN_BUFFER_SUPPORTED
    mainp->whole_image[0] = NULL; /* flag for no virtual arrays */
#endif
    /* Allocate a strip buffer for each component */
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      mainp->buffer[ci] = (*cinfo->mem->alloc_sarray)
	((j_common_ptr) cinfo, JPOOL_IMAGE,
	 compptr->width_in_blocks * DCTSIZE,
	 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movl $0x70, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, %r14
movq %rax, 0x1b8(%rbx)
leaq 0x74(%rip), %rax        # 0x754de
movq %rax, (%r14)
cmpl $0x0, 0x100(%rbx)
je 0x7547f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
testl %ebp, %ebp
je 0x7549a
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *(%rax)
cmpl $0x0, 0x4c(%rbx)
jle 0x75476
movq 0x58(%rbx), %r15
addq $0x1c, %r15
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
movl -0x10(%r15), %ecx
movl (%r15), %edx
shll $0x3, %edx
shll $0x3, %ecx
movq %rbx, %rdi
movl $0x1, %esi
callq *0x10(%rax)
movq %rax, 0x20(%r14,%r12,8)
incq %r12
movslq 0x4c(%rbx), %rax
addq $0x60, %r15
cmpq %rax, %r12
jl 0x754ab
jmp 0x75476
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmainct.c
// Function: process_data_simple_main
METHODDEF(void)
process_data_simple_main (j_compress_ptr cinfo,
			  JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
			  JDIMENSION in_rows_avail)
{
  my_main_ptr mainp = (my_main_ptr) cinfo->main;

  while (mainp->cur_iMCU_row < cinfo->total_iMCU_rows) {
    /* Read input data if we haven't filled the main buffer yet */
    if (mainp->rowgroup_ctr < DCTSIZE)
      (*cinfo->prep->pre_process_data) (cinfo,
					input_buf, in_row_ctr, in_rows_avail,
					mainp->buffer, &mainp->rowgroup_ctr,
					(JDIMENSION) DCTSIZE);

    /* If we don't have a full iMCU row buffered, return to application for
     * more data.  Note that preprocessor will always pad to fill the iMCU row
     * at the bottom of the image.
     */
    if (mainp->rowgroup_ctr != DCTSIZE)
      return;

    /* Send the completed row to the compressor */
    if (! (*cinfo->coef->compress_data) (cinfo, mainp->buffer)) {
      /* If compressor did not consume the whole row, then we must need to
       * suspend processing and return to the application.  In this situation
       * we pretend we didn't yet consume the last input row; otherwise, if
       * it happened to be the last row of the image, the application would
       * think we were done.
       */
      if (! mainp->suspended) {
	(*in_row_ctr)--;
	mainp->suspended = TRUE;
      }
      return;
    }
    /* We did finish the row.  Undo our little suspension hack if a previous
     * call suspended; then mark the main buffer empty.
     */
    if (mainp->suspended) {
      (*in_row_ctr)++;
      mainp->suspended = FALSE;
    }
    mainp->rowgroup_ctr = 0;
    mainp->cur_iMCU_row++;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0x14(%rsp)
movq 0x1b8(%rdi), %rbp
movl 0x10(%rbp), %eax
cmpl 0x140(%rdi), %eax
jae 0x755d4
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x14(%rbp), %r12
leaq 0x20(%rbp), %r13
cmpl $0x7, (%r12)
ja 0x75581
movq 0x1c0(%r15), %rax
movl $0x8, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl 0x14(%rsp), %ecx
movq %r13, %r8
movq %r12, %r9
callq *0x8(%rax)
cmpl $0x8, (%r12)
jne 0x755d4
movq 0x1c8(%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
callq *0x8(%rax)
testl %eax, %eax
je 0x755c5
cmpl $0x0, 0x18(%rbp)
je 0x755ab
incl (%rbx)
movl $0x0, 0x18(%rbp)
movl $0x0, 0x14(%rbp)
movl 0x10(%rbp), %eax
incl %eax
movl %eax, 0x10(%rbp)
cmpl 0x140(%r15), %eax
jb 0x75556
jmp 0x755d4
cmpl $0x0, 0x18(%rbp)
jne 0x755d4
decl (%rbx)
movl $0x1, 0x18(%rbp)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcprepct.c
// Function: start_pass_prep
METHODDEF(void)
start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
  my_prep_ptr prep = (my_prep_ptr) cinfo->prep;

  if (pass_mode != JBUF_PASS_THRU)
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);

  /* Initialize total-height counter for detecting bottom of image */
  prep->rows_to_go = cinfo->image_height;
  /* Mark the conversion buffer empty */
  prep->next_buf_row = 0;
#ifdef CONTEXT_ROWS_SUPPORTED
  /* Preset additional state variables for context mode.
   * These aren't used in non-context mode, so we needn't test which mode.
   */
  prep->this_row_group = 0;
  /* Set next_buf_stop to stop after two row groups have been read in. */
  prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
#endif
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1c0(%rdi), %r14
testl %esi, %esi
je 0x7582f
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movl 0x34(%rbx), %eax
movl %eax, 0x60(%r14)
movq $0x0, 0x64(%r14)
movl 0x13c(%rbx), %eax
addl %eax, %eax
movl %eax, 0x6c(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccoefct.c
// Function: jinit_c_coef_controller
GLOBAL(void)
jinit_c_coef_controller (j_compress_ptr cinfo, jboolean need_full_buffer)
{
  my_coef_ptr coef;

  coef = (my_coef_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_coef_controller));
  cinfo->coef = (struct jpeg_c_coef_controller *) coef;
  coef->pub.start_pass = start_pass_coef;

  /* Create the coefficient buffer. */
  if (need_full_buffer) {
#ifdef FULL_COEF_BUFFER_SUPPORTED
    /* Allocate a full-image virtual array for each component, */
    /* padded to a multiple of samp_factor DCT blocks in each direction. */
    int ci;
    jpeg_component_info *compptr;

    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
				(long) compptr->h_samp_factor),
	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
				(long) compptr->v_samp_factor),
	 (JDIMENSION) compptr->v_samp_factor);
    }
#else
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
#endif
  } else {
    /* We only need a single-MCU buffer. */
    JBLOCKROW buffer;
    int i;

    buffer = (JBLOCKROW)
      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
    for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
      coef->MCU_buffer[i] = buffer + i;
    }
    coef->whole_image[0] = NULL; /* flag for no virtual arrays */
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rdi), %rax
movl $0xc0, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, %rbx
movq %rax, 0x1c8(%r14)
leaq 0xdd(%rip), %rax        # 0x75e12
movq %rax, (%rbx)
testl %ebp, %ebp
je 0x75da8
cmpl $0x0, 0x4c(%r14)
jle 0x75e03
movq 0x58(%r14), %r12
addq $0x8, %r12
xorl %r13d, %r13d
movq 0x8(%r14), %rax
movq 0x28(%rax), %rbp
movl 0x14(%r12), %edi
movslq (%r12), %rsi
callq 0x86aa9
movq %rax, %r15
movl 0x18(%r12), %edi
movslq 0x4(%r12), %rsi
callq 0x86aa9
movl 0x4(%r12), %r9d
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
movl %r15d, %ecx
movl %eax, %r8d
callq *%rbp
movq %rax, 0x70(%rbx,%r13,8)
incq %r13
movslq 0x4c(%r14), %rax
addq $0x60, %r12
cmpq %rax, %r13
jl 0x75d52
jmp 0x75e03
movq 0x8(%r14), %rax
movl $0x500, %edx            # imm = 0x500
movq %r14, %rdi
movl $0x1, %esi
callq *0x8(%rax)
movdqa 0x2c4bc(%rip), %xmm0    # 0xa2280
movl $0x4, %ecx
movq %rax, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movdqa 0x2c4c5(%rip), %xmm2    # 0xa22a0
movdqa %xmm0, %xmm3
psllq $0x7, %xmm3
paddq %xmm1, %xmm3
movdqu %xmm3, (%rbx,%rcx,8)
paddq %xmm2, %xmm0
addq $0x2, %rcx
cmpq $0xe, %rcx
jne 0x75ddb
movq $0x0, 0x70(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccoefct.c
// Function: start_pass_coef
METHODDEF(void)
start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;

  coef->iMCU_row_num = 0;
  start_iMCU_row(cinfo);

  switch (pass_mode) {
  case JBUF_PASS_THRU:
    if (coef->whole_image[0] != NULL)
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    coef->pub.compress_data = compress_data;
    break;
#ifdef FULL_COEF_BUFFER_SUPPORTED
  case JBUF_SAVE_AND_PASS:
    if (coef->whole_image[0] == NULL)
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    coef->pub.compress_data = compress_first_pass;
    break;
  case JBUF_CRANK_DEST:
    if (coef->whole_image[0] == NULL)
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    coef->pub.compress_data = compress_output;
    break;
#endif
  default:
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    break;
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x1c8(%rdi), %r14
movl $0x0, 0x10(%r14)
callq 0x75eb4
cmpl $0x3, %ebp
je 0x75e7b
cmpl $0x2, %ebp
je 0x75e5c
testl %ebp, %ebp
jne 0x75ea1
cmpq $0x0, 0x70(%r14)
je 0x75e53
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
leaq 0x9b(%rip), %rax        # 0x75ef5
jmp 0x75e98
cmpq $0x0, 0x70(%r14)
jne 0x75e72
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
leaq 0xa92(%rip), %rax       # 0x7690b
jmp 0x75e98
cmpq $0x0, 0x70(%r14)
jne 0x75e91
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
leaq 0x2d6(%rip), %rax       # 0x7616e
movq %rax, 0x8(%r14)
popq %rbx
popq %r14
popq %rbp
retq
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *(%rax)
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccolor.c
// Function: grayscale_convert
METHODDEF(void)
grayscale_convert (j_compress_ptr cinfo,
		   JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
		   JDIMENSION output_row, int num_rows)
{
  register JSAMPROW inptr;
  register JSAMPROW outptr;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->image_width;
  int instride = cinfo->input_components;

  while (--num_rows >= 0) {
    inptr = *input_buf++;
    outptr = output_buf[0][output_row];
    output_row++;
    for (col = 0; col < num_cols; col++) {
      outptr[col] = inptr[0];	/* don't need GETJSAMPLE() here */
      inptr += instride;
    }
  }
}

// Assembly:
testl %r8d, %r8d
jle 0x76ccd
pushq %rbx
movl 0x30(%rdi), %eax
movslq 0x38(%rdi), %rdi
testq %rax, %rax
je 0x76cb9
movq (%rdx), %r9
movl %ecx, %r10d
movq (%r9,%r10,8), %r9
movq (%rsi), %r10
xorl %r11d, %r11d
movb (%r10), %bl
movb %bl, (%r9,%r11)
addq %rdi, %r10
incq %r11
cmpq %r11, %rax
jne 0x76ca7
leal -0x1(%r8), %r9d
addq $0x8, %rsi
incl %ecx
cmpl $0x2, %r8d
movl %r9d, %r8d
jge 0x76c92
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccolor.c
// Function: rgb_ycc_start
METHODDEF(void)
rgb_ycc_start (j_compress_ptr cinfo)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  INT32 * rgb_ycc_tab;
  INT32 i;

  /* Allocate and fill in the conversion tables. */
  cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				(TABLE_SIZE * SIZEOF(INT32)));

  for (i = 0; i <= MAXJSAMPLE; i++) {
    rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
    rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
    rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i     + ONE_HALF;
    rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
    rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
    /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
     * This ensures that the maximum output will round to MAXJSAMPLE
     * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
     */
    rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
/*  B=>Cb and R=>Cr tables are the same
    rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
*/
    rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
    rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
  }
}

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rax
movq 0x1d8(%rdi), %rbx
movl $0x4000, %edx           # imm = 0x4000
movl $0x1, %esi
callq *(%rax)
movq %rax, 0x10(%rbx)
addq $0x3800, %rax           # imm = 0x3800
movl $0x8000, %ecx           # imm = 0x8000
movl $0x807fff, %edx         # imm = 0x807FFF
xorl %esi, %esi
xorl %edi, %edi
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %r11d, %r11d
movq %rsi, -0x3800(%rax)
movq %rdi, -0x3000(%rax)
movq %rcx, -0x2800(%rax)
movq %r8, -0x2000(%rax)
movq %r9, -0x1800(%rax)
movq %rdx, -0x1000(%rax)
movq %r10, -0x800(%rax)
movq %r11, (%rax)
addq $-0x14d1, %r11          # imm = 0xEB2F
addq $-0x6b2f, %r10          # imm = 0x94D1
addq $-0x54cd, %r9           # imm = 0xAB33
addq $-0x2b33, %r8           # imm = 0xD4CD
addq $0x1d2f, %rcx           # imm = 0x1D2F
addq $0x9646, %rdi           # imm = 0x9646
addq $0x8, %rax
addq $0x4c8b, %rsi           # imm = 0x4C8B
addq $0x8000, %rdx           # imm = 0x8000
cmpq $-0x14d100, %r11        # imm = 0xFFEB2F00
jne 0x76d0a
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccolor.c
// Function: rgb_gray_convert
METHODDEF(void)
rgb_gray_convert (j_compress_ptr cinfo,
		  JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
		  JDIMENSION output_row, int num_rows)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  register int r, g, b;
  register INT32 * ctab = cconvert->rgb_ycc_tab;
  register JSAMPROW inptr;
  register JSAMPROW outptr;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->image_width;

  while (--num_rows >= 0) {
    inptr = *input_buf++;
    outptr = output_buf[0][output_row];
    output_row++;
    for (col = 0; col < num_cols; col++) {
      r = GETJSAMPLE(inptr[RGB_RED]);
      g = GETJSAMPLE(inptr[RGB_GREEN]);
      b = GETJSAMPLE(inptr[RGB_BLUE]);
      inptr += RGB_PIXELSIZE;
      /* Y */
      outptr[col] = (JSAMPLE)
		((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
		 >> SCALEBITS);
    }
  }
}

// Assembly:
testl %r8d, %r8d
jle 0x76dfb
pushq %rbp
pushq %r14
pushq %rbx
movq 0x1d8(%rdi), %rax
movq 0x10(%rax), %rax
movl 0x30(%rdi), %edi
testq %rdi, %rdi
je 0x76de4
movq (%rdx), %r9
movl %ecx, %r10d
movq (%r9,%r10,8), %r9
movq (%rsi), %r10
xorl %r11d, %r11d
movzbl (%r10), %ebx
movzbl 0x1(%r10), %r14d
movl 0x800(%rax,%r14,8), %ebp
addl (%rax,%rbx,8), %ebp
movzbl 0x2(%r10), %ebx
addl 0x1000(%rax,%rbx,8), %ebp
shrl $0x10, %ebp
movb %bpl, (%r9,%r11)
incq %r11
addq $0x3, %r10
cmpq %r11, %rdi
jne 0x76db1
leal -0x1(%r8), %r9d
addq $0x8, %rsi
incl %ecx
cmpl $0x2, %r8d
movl %r9d, %r8d
jge 0x76d9c
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccolor.c
// Function: null_convert
METHODDEF(void)
null_convert (j_compress_ptr cinfo,
	      JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
	      JDIMENSION output_row, int num_rows)
{
  register JSAMPROW inptr;
  register JSAMPROW outptr;
  register JDIMENSION col;
  register int ci;
  int nc = cinfo->num_components;
  JDIMENSION num_cols = cinfo->image_width;

  while (--num_rows >= 0) {
    /* It seems fastest to make a separate pass for each component. */
    for (ci = 0; ci < nc; ci++) {
      inptr = *input_buf;
      outptr = output_buf[ci][output_row];
      for (col = 0; col < num_cols; col++) {
	outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
	inptr += nc;
      }
    }
    input_buf++;
    output_row++;
  }
}

// Assembly:
testl %r8d, %r8d
jle 0x76e5d
pushq %rbp
pushq %r14
pushq %rbx
movslq 0x4c(%rdi), %rax
movl 0x30(%rdi), %edi
testl %eax, %eax
jle 0x76e46
movl %ecx, %r9d
xorl %r10d, %r10d
testq %rdi, %rdi
je 0x76e3e
movq (%rdx,%r10,8), %r11
movq (%r11,%r9,8), %r11
movq (%rsi), %rbx
addq %r10, %rbx
xorl %r14d, %r14d
movb (%rbx), %bpl
movb %bpl, (%r11,%r14)
incq %r14
addq %rax, %rbx
cmpq %r14, %rdi
jne 0x76e2c
incq %r10
cmpq %rax, %r10
jne 0x76e16
leal -0x1(%r8), %r9d
addq $0x8, %rsi
incl %ecx
cmpl $0x1, %r8d
movl %r9d, %r8d
jg 0x76e0c
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jccolor.c
// Function: rgb_ycc_convert
METHODDEF(void)
rgb_ycc_convert (j_compress_ptr cinfo,
		 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
		 JDIMENSION output_row, int num_rows)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  register int r, g, b;
  register INT32 * ctab = cconvert->rgb_ycc_tab;
  register JSAMPROW inptr;
  register JSAMPROW outptr0, outptr1, outptr2;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->image_width;

  while (--num_rows >= 0) {
    inptr = *input_buf++;
    outptr0 = output_buf[0][output_row];
    outptr1 = output_buf[1][output_row];
    outptr2 = output_buf[2][output_row];
    output_row++;
    for (col = 0; col < num_cols; col++) {
      r = GETJSAMPLE(inptr[RGB_RED]);
      g = GETJSAMPLE(inptr[RGB_GREEN]);
      b = GETJSAMPLE(inptr[RGB_BLUE]);
      inptr += RGB_PIXELSIZE;
      /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
       * must be too; we do not need an explicit range-limiting operation.
       * Hence the value being shifted is never negative, and we don't
       * need the general RIGHT_SHIFT macro.
       */
      /* Y */
      outptr0[col] = (JSAMPLE)
		((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
		 >> SCALEBITS);
      /* Cb */
      outptr1[col] = (JSAMPLE)
		((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
		 >> SCALEBITS);
      /* Cr */
      outptr2[col] = (JSAMPLE)
		((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
		 >> SCALEBITS);
    }
  }
}

// Assembly:
testl %r8d, %r8d
jle 0x76f3c
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x1d8(%rdi), %rax
movq 0x10(%rax), %rax
movl 0x30(%rdi), %edi
testq %rdi, %rdi
je 0x76f1b
movl %ecx, %r11d
movq (%rdx), %r9
movq 0x8(%rdx), %r10
movq (%r9,%r11,8), %r9
movq (%r10,%r11,8), %r10
movq 0x10(%rdx), %rbx
movq (%rbx,%r11,8), %r11
movq (%rsi), %rbx
xorl %r14d, %r14d
movzbl (%rbx), %r15d
movzbl 0x1(%rbx), %r12d
movl 0x800(%rax,%r12,8), %ebp
addl (%rax,%r15,8), %ebp
movzbl 0x2(%rbx), %r13d
addl 0x1000(%rax,%r13,8), %ebp
shrl $0x10, %ebp
movb %bpl, (%r9,%r14)
movl 0x2000(%rax,%r12,8), %ebp
addl 0x1800(%rax,%r15,8), %ebp
addl 0x2800(%rax,%r13,8), %ebp
shrl $0x10, %ebp
movb %bpl, (%r10,%r14)
movl 0x3000(%rax,%r12,8), %ebp
addl 0x2800(%rax,%r15,8), %ebp
addl 0x3800(%rax,%r13,8), %ebp
shrl $0x10, %ebp
movb %bpl, (%r11,%r14)
incq %r14
addq $0x3, %rbx
cmpq %r14, %rdi
jne 0x76ea8
leal -0x1(%r8), %r9d
addq $0x8, %rsi
incl %ecx
cmpl $0x2, %r8d
movl %r9d, %r8d
jge 0x76e7f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq