// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/src/fmtutil.c
// Function: fmtutil_macbitmap_read_pixmap_only_fields
void fmtutil_macbitmap_read_pixmap_only_fields(deark *c, dbuf *f, struct fmtutil_macbitmap_info *bi,
	i64 pos)
{
	i64 pixmap_version;
	i64 pack_size;
	i64 plane_bytes;
	i64 n;

	de_dbg(c, "additional PixMap header fields, at %d", (int)pos);
	de_dbg_indent(c, 1);

	pixmap_version = dbuf_getu16be(f, pos+0);
	de_dbg(c, "pixmap version: %d", (int)pixmap_version);

	bi->packing_type = dbuf_getu16be(f, pos+2);
	de_dbg(c, "packing type: %d", (int)bi->packing_type);

	pack_size = dbuf_getu32be(f, pos+4);
	de_dbg(c, "pixel data length: %d", (int)pack_size);

	bi->hdpi = pict_read_fixed(f, pos+8);
	bi->vdpi = pict_read_fixed(f, pos+12);
	de_dbg(c, "dpi: %.2f"DE_CHAR_TIMES"%.2f", bi->hdpi, bi->vdpi);

	bi->pixeltype = dbuf_getu16be(f, pos+16);
	bi->pixelsize = dbuf_getu16be(f, pos+18);
	bi->cmpcount = dbuf_getu16be(f, pos+20);
	bi->cmpsize = dbuf_getu16be(f, pos+22);
	de_dbg(c, "pixel type=%d, bits/pixel=%d, components/pixel=%d, bits/comp=%d",
		(int)bi->pixeltype, (int)bi->pixelsize, (int)bi->cmpcount, (int)bi->cmpsize);

	if(bi->pixelsize>0) {
		bi->pdwidth = (bi->rowbytes*8)/bi->pixelsize;
	}
	if(bi->pdwidth < bi->npwidth) {
		bi->pdwidth = bi->npwidth;
	}

	plane_bytes = dbuf_getu32be(f, pos+24);
	de_dbg(c, "plane bytes: %d", (int)plane_bytes);

	bi->pmTable = (u32)dbuf_getu32be(f, pos+28);
	de_dbg(c, "pmTable: 0x%08x", (unsigned int)bi->pmTable);

	n = dbuf_getu32be(f, pos+32);
	de_dbg(c, "pmReserved: 0x%08x", (unsigned int)n);

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x4f6e5(%rip), %rsi     # 0x13d3af
movl %r14d, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %r15, %rdi
movq %r14, %rsi
callq 0xe3f46
leaq 0x4f6e5(%rip), %rsi     # 0x13d3d6
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
leaq 0x2(%r14), %rsi
movq %r15, %rdi
callq 0xe3f46
movq %rax, 0x30(%r12)
leaq 0x3bdf2(%rip), %rsi     # 0x129b07
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
leaq 0x4(%r14), %rsi
movq %r15, %rdi
callq 0xe404f
leaq 0x4f6b5(%rip), %rsi     # 0x13d3e9
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
leaq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0xede95
movsd %xmm0, 0x58(%r12)
leaq 0xc(%r14), %rsi
movq %r15, %rdi
callq 0xede95
movaps %xmm0, %xmm1
movsd %xmm0, 0x60(%r12)
movsd 0x58(%r12), %xmm0
leaq 0x3c0c5(%rip), %rsi     # 0x129e3c
movq %rbx, %rdi
movb $0x2, %al
callq 0xde896
leaq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0xe3f46
movq %rax, 0x38(%r12)
leaq 0x12(%r14), %rsi
movq %r15, %rdi
callq 0xe3f46
movq %rax, 0x40(%r12)
leaq 0x14(%r14), %rsi
movq %r15, %rdi
callq 0xe3f46
movq %rax, 0x48(%r12)
leaq 0x16(%r14), %rsi
movq %r15, %rdi
callq 0xe3f46
movq %rax, 0x50(%r12)
movl 0x38(%r12), %edx
movl 0x40(%r12), %ecx
movl 0x48(%r12), %r8d
leaq 0x4f624(%rip), %rsi     # 0x13d3ff
movq %rbx, %rdi
movl %eax, %r9d
xorl %eax, %eax
callq 0xde896
movq 0x40(%r12), %rcx
testq %rcx, %rcx
jle 0xede06
movq (%r12), %rax
shlq $0x3, %rax
cqto
idivq %rcx
movq %rax, 0x18(%r12)
jmp 0xede0b
movq 0x18(%r12), %rax
movq 0x10(%r12), %rcx
cmpq %rcx, %rax
jge 0xede1a
movq %rcx, 0x18(%r12)
leaq 0x18(%r14), %rsi
movq %r15, %rdi
callq 0xe404f
leaq 0x4f612(%rip), %rsi     # 0x13d43f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
leaq 0x1c(%r14), %rsi
movq %r15, %rdi
callq 0xe404f
movl %eax, 0x68(%r12)
leaq 0x4f5fe(%rip), %rsi     # 0x13d44f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
addq $0x20, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xe404f
leaq 0x4f5ec(%rip), %rsi     # 0x13d45f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xdeba7