// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/psd.c
// Function: do_custom_shape
static void do_custom_shape(deark *c, lctx *d, zztype *zz)
{
	de_ucstring *s = NULL;
	i64 dlen;
	i64 saved_pos;
	zztype datazz;
	zztype pathinfozz;

	s = ucstring_create(c);
	saved_pos = zz->pos;
	read_unicode_string(c, d, s, zz);
	de_dbg(c, "name: \"%s\"", ucstring_getpsz_d(s));
	// This Unicode String is padded to a multiple of 4 bytes, unlike pretty much
	// every other Unicode String in every Photoshop format.
	zz->pos = saved_pos + de_pad_to_4(zz->pos - saved_pos);

	zz->pos += 4; // Unknown field

	dlen = psd_getu32zz(zz);
	de_dbg(c, "shape data length: %d", (int)dlen);

	zz_init_with_len(&datazz, zz, dlen);
	// We expect this length to be a multiple of 4. I don't know what to do if
	// it's not.
	zz->pos += dlen;

	ucstring_empty(s);
	read_pascal_string_to_ucstring(c, d, s, &datazz);
	de_dbg(c, "id: \"%s\"", ucstring_getpsz(s));

	read_rectangle_tlbr(c, d, &datazz, "bounds");

	de_dbg(c, "path records at %d", (int)datazz.pos);
	zz_init(&pathinfozz, &datazz);
	de_dbg_indent(c, 1);
	do_pathinfo(c, d, &pathinfozz);
	de_dbg_indent(c, -1);

	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0xf54d0
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rdi
callq 0x172650
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq 0xb1b05(%rip), %rsi     # 0x1ae1d0
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
subq -0x30(%rbp), %rdi
callq 0x15ce30
movq -0x70(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x4, %rcx
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
callq 0xf3330
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0xc40a7(%rip), %rsi     # 0x1c07da
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0xf3380
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
callq 0x171210
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0xf3e30
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x172500
movq -0x68(%rbp), %rdi
movq %rax, %rdx
leaq 0xbcfb9(%rip), %rsi     # 0x1b974f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq 0xa1aaa(%rip), %rcx     # 0x19e25a
callq 0xf5820
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl %eax, %edx
leaq 0xc402a(%rip), %rsi     # 0x1c07f0
movb $0x0, %al
callq 0x15b0d0
leaq -0x60(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xf3580
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xf7720
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x20(%rbp), %rdi
callq 0x171750
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)