// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/psd.c
// Function: hrsrc_pluginresource
static void hrsrc_pluginresource(deark *c, lctx *d, zztype *zz, const struct rsrc_info *ri)
{
	struct de_fourcc fourcc;
	zztype czz;

	// Plug-in resources seem to start with a fourcc.
	if(zz_avail(zz)<4) return;
	psd_read_fourcc_zz(c, d, zz, &fourcc);
	de_dbg(c, "id: '%s'", fourcc.id_dbgstr);
	zz_init(&czz, zz);
	switch(fourcc.id) {
	case CODE_mani:
		do_pluginrsrc_mani(c, d, &czz);
		break;
	case CODE_mopt:
		do_pluginrsrc_mopt(c, d, &czz);
		break;
	case CODE_mset:
		do_pluginrsrc_descriptor(c, d, &czz);
		break;
	default:
		if(zz_avail(&czz)>0) {
			de_dbg(c, "[%d more bytes of plug-in resource data at %d]",
				(int)zz_avail(&czz), (int)czz.startpos);
			if(c->debug_level>=2) {
				de_dbg_indent(c, 1);
				de_dbg_hexdump(c, c->infile, czz.startpos, zz_avail(&czz), 256, NULL, 0x1);
				de_dbg_indent(c, -1);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, %rdi
callq 0x9ff2f
cmpq $0x4, %rax
jge 0x9ffa1
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x68(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x9fe82
leaq 0x78(%rsp), %r13
leaq 0x67532(%rip), %rsi     # 0x1074f2
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq (%r15), %r12
movq 0x10(%r15), %r15
movq %r12, 0x18(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x20(%rsp)
movl -0xc(%r13), %eax
cmpl $0x6d736574, %eax       # imm = 0x6D736574
je 0xa02df
cmpl $0x6d6f7074, %eax       # imm = 0x6D6F7074
je 0xa00ee
cmpl $0x6d616e69, %eax       # imm = 0x6D616E69
jne 0xa0309
subq %r12, %r15
setle %al
cmpq $0x4, %r15
setl %cl
orb %al, %cl
jne 0x9ff8f
leaq 0x10(%rsp), %rdx
leaq 0x38(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9fe82
leaq 0x48(%rsp), %r15
leaq 0x674b4(%rip), %rsi     # 0x1074f2
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
cmpl $0x49524652, -0xc(%r15) # imm = 0x49524652
jne 0x9ff8f
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rax
cmpq %rax, %rcx
jge 0x9ff8f
movq 0x18(%rsp), %rdx
cmpq %rdx, %rcx
cmovgq %rcx, %rdx
subq %rdx, %rax
cmpq $0x4, %rax
jl 0x9ff8f
movq 0x18(%rbx), %rdi
movl 0x4(%r14), %edx
leaq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x9fe70
leaq 0x7e174(%rip), %rsi     # 0x11e215
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq (%r15), %rcx
movq 0x10(%r15), %rax
cmpq %rax, %rcx
jge 0x9ff8f
movq 0x18(%rsp), %rdx
cmpq %rdx, %rcx
cmovgq %rcx, %rdx
subq %rdx, %rax
cmpq $0xc, %rax
jl 0x9ff8f
leaq 0x10(%rsp), %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa2803
jmp 0x9ff8f
leaq 0x2c(%rsp), %rsi
movq %rbx, %rdi
callq 0xdebae
movq 0x18(%rbx), %rdi
movl 0x4(%r14), %edx
leaq 0x10(%rsp), %r12
movq %r12, %rsi
callq 0x9fe70
leaq 0x87373(%rip), %rsi     # 0x12748a
xorl %r15d, %r15d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movl 0x4(%r14), %edx
movq %r12, %rsi
callq 0x9fe70
movq %rax, %r12
leaq 0x8735a(%rip), %rsi     # 0x12749a
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
testq %r12, %r12
cmovleq %r15, %r12
movq %r12, 0x30(%rsp)
xorl %r13d, %r13d
cmpq %r13, 0x30(%rsp)
je 0xa02ce
movq 0x10(%rsp), %r15
movq 0x20(%rsp), %rbp
cmpq %rbp, %r15
jge 0xa02ce
movq 0x18(%rsp), %r12
cmpq %r12, %r15
movq %r12, %rax
cmovgq %r15, %rax
movq %rbp, %rcx
subq %rax, %rcx
cmpq $0x472, %rcx            # imm = 0x472
jl 0xa02ce
movq %rbx, %rdi
leaq 0x8730d(%rip), %rsi     # 0x1274b3
movl %r13d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq %rbx, %rdi
leaq 0x86f81(%rip), %rsi     # 0x127149
movl $0x472, %edx            # imm = 0x472
movl %r15d, %ecx
xorl %eax, %eax
callq 0xde896
cmpl $0x2, (%rbx)
jl 0xa0216
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x18(%rbx), %rsi
movl $0x1, (%rsp)
movl $0x472, %ecx            # imm = 0x472
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r15, %rdx
xorl %r9d, %r9d
callq 0xded3a
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
addq $0x472, %r15            # imm = 0x472
movq %r15, 0x10(%rsp)
cmpq %rbp, %r15
jge 0xa02ce
cmpq %r12, %r15
cmovgq %r15, %r12
subq %r12, %rbp
cmpq $0x4, %rbp
jl 0xa02ce
movq 0x18(%rbx), %rdi
movl 0x4(%r14), %edx
leaq 0x10(%rsp), %rsi
callq 0x9fe70
movq %rax, %r15
movq %rbx, %rdi
leaq 0x87269(%rip), %rsi     # 0x1274c7
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
testq %r15, %r15
jle 0xa02bb
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq %rcx, %rax
jge 0xa02bb
cmpq %rcx, 0x18(%rsp)
jge 0xa02bb
addq %rax, %r15
cmpq %rcx, %r15
cmovlq %r15, %rcx
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq %rcx, 0x48(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x38(%rsp), %rdx
pushq $0x1
popq %rcx
leaq 0x979af(%rip), %r8      # 0x137c60
callq 0xa147d
movq %r15, 0x10(%rsp)
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
incq %r13
jmp 0xa015c
movl 0x2c(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
jmp 0x9ff8f
leaq 0x38(%rsp), %rdx
movq %r12, 0x8(%rdx)
movq %r12, (%rdx)
movq %r15, 0x10(%rdx)
leaq 0x9796a(%rip), %r8      # 0x137c60
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa147d
jmp 0x9ff8f
subq %r12, %r15
jle 0x9ff8f
leaq 0x868b7(%rip), %rsi     # 0x126bd0
movq %rbx, %rdi
movl %r15d, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0xde896
cmpl $0x2, (%rbx)
jl 0x9ff8f
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rsi
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r12, %rdx
movq %r15, %rcx
xorl %r9d, %r9d
callq 0xded3a
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
jmp 0x9ff8f