// File: /workspace/github_c_makefile_star2_O3/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 0x51241(%rip), %rsi     # 0x14a87f
movl %r14d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r15, %rdi
movq %r14, %rsi
callq 0xeeb67
leaq 0x5123f(%rip), %rsi     # 0x14a8a6
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x2(%r14), %rsi
movq %r15, %rdi
callq 0xeeb67
movq %rax, 0x30(%r12)
leaq 0x3d77c(%rip), %rsi     # 0x136e07
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x4(%r14), %rsi
movq %r15, %rdi
callq 0xeed0d
leaq 0x5120f(%rip), %rsi     # 0x14a8b9
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0xeedae
cvtsi2sd %rax, %xmm0
mulsd 0x2d0b9(%rip), %xmm0    # 0x126788
movsd %xmm0, 0x58(%r12)
leaq 0xc(%r14), %rsi
movq %r15, %rdi
callq 0xeedae
cvtsi2sd %rax, %xmm1
mulsd 0x2d099(%rip), %xmm1    # 0x126788
movsd %xmm1, 0x60(%r12)
movsd 0x58(%r12), %xmm0
leaq 0x3da38(%rip), %rsi     # 0x13713c
movq %rbx, %rdi
movb $0x2, %al
callq 0xe8617
leaq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0xeeb67
movq %rax, 0x38(%r12)
leaq 0x12(%r14), %rsi
movq %r15, %rdi
callq 0xeeb67
movq %rax, 0x40(%r12)
leaq 0x14(%r14), %rsi
movq %r15, %rdi
callq 0xeeb67
movq %rax, 0x48(%r12)
leaq 0x16(%r14), %rsi
movq %r15, %rdi
callq 0xeeb67
movq %rax, 0x50(%r12)
movl 0x38(%r12), %edx
movl 0x40(%r12), %ecx
movl 0x48(%r12), %r8d
leaq 0x51167(%rip), %rsi     # 0x14a8cf
movq %rbx, %rdi
movl %eax, %r9d
xorl %eax, %eax
callq 0xe8617
movq 0x40(%r12), %rcx
testq %rcx, %rcx
jle 0xf9793
movq (%r12), %rax
shlq $0x3, %rax
cqto
idivq %rcx
movq %rax, 0x18(%r12)
jmp 0xf9798
movq 0x18(%r12), %rax
movq 0x10(%r12), %rcx
cmpq %rcx, %rax
jge 0xf97a7
movq %rcx, 0x18(%r12)
leaq 0x18(%r14), %rsi
movq %r15, %rdi
callq 0xeed0d
leaq 0x51155(%rip), %rsi     # 0x14a90f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x1c(%r14), %rsi
movq %r15, %rdi
callq 0xeed0d
movl %eax, 0x68(%r12)
leaq 0x51141(%rip), %rsi     # 0x14a91f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x20, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xeed0d
leaq 0x5112f(%rip), %rsi     # 0x14a92f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe8a15