// File: tomfunkhouser[P]gaps/pkgs/png/pngrutil.c
// Function: png_handle_oFFs
void /* PRIVATE */
png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
   png_byte buf[9];
   png_int_32 offset_x, offset_y;
   int unit_type;

   png_debug(1, "in png_handle_oFFs");

   if (!(png_ptr->mode & PNG_HAVE_IHDR))
      png_error(png_ptr, "Missing IHDR before oFFs");
   else if (png_ptr->mode & PNG_HAVE_IDAT)
   {
      png_warning(png_ptr, "Invalid oFFs after IDAT");
      png_crc_finish(png_ptr, length);
      return;
   }
   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
   {
      png_warning(png_ptr, "Duplicate oFFs chunk");
      png_crc_finish(png_ptr, length);
      return;
   }

   if (length != 9)
   {
      png_warning(png_ptr, "Incorrect oFFs chunk length");
      png_crc_finish(png_ptr, length);
      return;
   }

   png_crc_read(png_ptr, buf, 9);
   if (png_crc_finish(png_ptr, 0))
      return;

   offset_x = png_get_int_32(buf);
   offset_y = png_get_int_32(buf + 4);
   unit_type = buf[8];
   png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, unit_type);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movq 0x30(%rsp), %rax
movl 0x11c(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x125c88
movq 0x30(%rsp), %rdi
leaq 0x19dcf(%rip), %rsi     # 0x13fa50
callq 0x113860
jmp 0x125d01
movq 0x30(%rsp), %rax
movl 0x11c(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x125cbf
movq 0x30(%rsp), %rdi
leaq 0x19dc2(%rip), %rsi     # 0x13fa69
callq 0x113940
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x122b90
jmp 0x125e5d
cmpq $0x0, 0x28(%rsp)
je 0x125cfd
movq 0x28(%rsp), %rax
movl 0x8(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x125cfd
movq 0x30(%rsp), %rdi
leaq 0x19d9c(%rip), %rsi     # 0x13fa81
callq 0x113940
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x122b90
jmp 0x125e5d
jmp 0x125cff
jmp 0x125d01
cmpl $0x9, 0x24(%rsp)
je 0x125d2c
movq 0x30(%rsp), %rdi
leaq 0x19d82(%rip), %rsi     # 0x13fa96
callq 0x113940
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x122b90
jmp 0x125e5d
movq 0x30(%rsp), %rdi
leaq 0x1b(%rsp), %rsi
movl $0x9, %edx
callq 0x122b40
movq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x122b90
cmpl $0x0, %eax
je 0x125d56
jmp 0x125e5d
movzbl 0x1b(%rsp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x125d98
movzbl 0x1b(%rsp), %ecx
shll $0x18, %ecx
movzbl 0x1c(%rsp), %eax
shll $0x10, %eax
addl %eax, %ecx
movzbl 0x1d(%rsp), %eax
shll $0x8, %eax
addl %eax, %ecx
movzbl 0x1e(%rsp), %eax
addl %eax, %ecx
xorl $-0x1, %ecx
addl $0x1, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, 0x8(%rsp)
jmp 0x125dbf
movzbl 0x1b(%rsp), %eax
shll $0x18, %eax
movzbl 0x1c(%rsp), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movzbl 0x1d(%rsp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movzbl 0x1e(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
movzbl 0x1f(%rsp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x125e09
movzbl 0x1f(%rsp), %ecx
shll $0x18, %ecx
movzbl 0x20(%rsp), %eax
shll $0x10, %eax
addl %eax, %ecx
movzbl 0x21(%rsp), %eax
shll $0x8, %eax
addl %eax, %ecx
movzbl 0x22(%rsp), %eax
addl %eax, %ecx
xorl $-0x1, %ecx
addl $0x1, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, 0x4(%rsp)
jmp 0x125e30
movzbl 0x1f(%rsp), %eax
shll $0x18, %eax
movzbl 0x20(%rsp), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movzbl 0x21(%rsp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movzbl 0x22(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x10(%rsp)
movzbl 0x23(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movl 0xc(%rsp), %r8d
callq 0xfd560
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)