// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/amigaicon.c
// Function: my_iff_chunk_handler
static int my_iff_chunk_handler(struct de_iffctx *ictx)
{
	deark *c = ictx->c;
	lctx *d = (lctx*)ictx->userdata;
	i64 dpos, dlen;

	if(ictx->chunkctx->chunk4cc.id == CODE_FORM) {
		ictx->is_std_container = 1;
		return 1;
	}

	if(ictx->level!=1) {
		return 1;
	}

	if(ictx->curr_container_contentstype4cc.id != CODE_ICON) {
		return 1;
	}

	dpos = ictx->chunkctx->dpos;
	dlen = ictx->chunkctx->dlen;

	switch(ictx->chunkctx->chunk4cc.id) {
	case CODE_FACE: // FACE (parameters)
		ictx->handled = 1;
		d->glowicons_width = 1+(i64)dbuf_getbyte(ictx->f, dpos);
		d->glowicons_height = 1+(i64)dbuf_getbyte(ictx->f, dpos+1);
		de_dbg_dimensions(c, d->glowicons_width, d->glowicons_height);
		break;
	case CODE_IMAG: // IMAG (one of the images that make up this icon)
		ictx->handled = 1;
		do_glowicons_IMAG(c, d, dpos, dlen);
		break;
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r15
movq 0x128(%rdi), %rcx
movl 0x4(%rcx), %eax
cmpl $0x464f524d, %eax       # imm = 0x464F524D
jne 0x1c0fc
movl $0x1, 0x134(%r15)
jmp 0x1c27b
cmpl $0x1, 0x64(%r15)
jne 0x1c27b
cmpl $0x49434f4e, 0xfc(%r15) # imm = 0x49434F4E
jne 0x1c27b
movq (%r15), %rbx
movq 0x10(%r15), %r14
movq 0x40(%rcx), %r12
cmpl $0x494d4147, %eax       # imm = 0x494D4147
je 0x1c183
cmpl $0x46414345, %eax       # imm = 0x46414345
jne 0x1c27b
movl $0x1, 0x130(%r15)
movq 0x18(%r15), %rdi
movq %r12, %rsi
callq 0xeead3
movzbl %al, %eax
incq %rax
movq %rax, 0x78(%r14)
movq 0x18(%r15), %rdi
incq %r12
movq %r12, %rsi
callq 0xeead3
movzbl %al, %edx
incq %rdx
movq %rdx, 0x80(%r14)
movq 0x78(%r14), %rsi
movq %rbx, %rdi
callq 0xe8f88
jmp 0x1c27b
movl $0x1, 0x130(%r15)
cmpq $0x0, 0x78(%r14)
jle 0x1c26a
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeead3
movzbl %al, %edx
leaq 0xf5719(%rip), %rsi     # 0x1118c8
movq %rbx, %rdi
movq %rdx, 0x30(%rsp)
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
leaq 0x1(%r12), %rsi
callq 0xeead3
movzbl %al, %eax
movq %rax, 0x50(%rsp)
leal 0x1(%rax), %edx
leaq 0xf564a(%rip), %rsi     # 0x111828
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
leaq 0x2(%r12), %rsi
callq 0xeead3
movzbl %al, %ebp
movl %ebp, %r13d
andl $0x1, %r13d
andl $0x2, %ebp
movl %ebp, %r15d
shrl %r15d
leaq 0xf56d2(%rip), %rsi     # 0x1118e2
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0xf56d3(%rip), %rsi     # 0x1118f7
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
leaq 0x3(%r12), %rsi
callq 0xeead3
movb %al, 0x13(%rsp)
movzbl %al, %r15d
leaq 0x100189(%rip), %rsi    # 0x11c3d7
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
cmpb $0x2, %r15b
jb 0x1c28f
leaq 0xf569f(%rip), %rsi     # 0x111907
jmp 0x1c271
leaq 0xf5640(%rip), %rsi     # 0x1118b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebp, %ebp
jne 0x1c29d
movl $0x0, 0x14(%rsp)
jmp 0x1c2d6
movq 0x18(%rbx), %rdi
leaq 0x4(%r12), %rsi
callq 0xeead3
movl %eax, 0x14(%rsp)
movzbl %al, %r15d
leaq 0xf566a(%rip), %rsi     # 0x111924
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
cmpb $0x2, %r15b
jb 0x1c2d6
leaq 0xf566d(%rip), %rsi     # 0x111941
jmp 0x1c271
movq 0x18(%rbx), %rdi
leaq 0x5(%r12), %rsi
callq 0xeead3
movzbl %al, %r15d
leaq 0xf5677(%rip), %rsi     # 0x111966
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
leal -0x9(%r15), %eax
cmpb $-0x9, %al
ja 0x1c31d
leaq 0xf566e(%rip), %rsi     # 0x111979
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9295
jmp 0x1c27b
movq 0x18(%rbx), %rdi
leaq 0x6(%r12), %rsi
callq 0xeeb67
movq %rax, 0x40(%rsp)
incq %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x8(%r12), %rsi
callq 0xeeb67
movq %rax, 0x48(%rsp)
leaq 0xa(%r12), %rax
movq %rax, 0x18(%rsp)
movl $0x2800, %esi           # imm = 0x2800
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf09c5
movl $0x100000, %esi         # imm = 0x100000
movq %rax, 0x28(%rsp)
movq %rax, %rdi
callq 0xf0a7c
leaq 0xf5627(%rip), %rsi     # 0x1119a4
movq %rbx, %rdi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0xe8617
testl %ebp, %ebp
je 0x1c476
movq %r15, 0x38(%rsp)
movq 0x48(%rsp), %rbp
incq %rbp
movq 0x40(%rsp), %rax
leaq (%rax,%r12), %r15
addq $0xb, %r15
leaq 0xf5603(%rip), %rsi     # 0x1119bd
movq %rbx, %rdi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
cmpb $0x0, 0x14(%rsp)
movq 0x28(%rsp), %rcx
movq %r15, %rsi
movq %rbp, %rdx
je 0x1c3f9
movl $0x8, %r8d
callq 0x1c53d
jmp 0x1c3fe
callq 0xef481
movq 0x30(%rsp), %rbp
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq 0x50(%rsp), %r15
jbe 0x1c41e
movl $0xff000000, 0x88(%r14,%r15,4) # imm = 0xFF000000
jmp 0x1c454
movq 0x28(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xef42f
movl %eax, %edx
andl $0xffffff, %edx         # imm = 0xFFFFFF
cmpq %r15, %rbp
cmovnel %eax, %edx
testl %r13d, %r13d
cmovel %eax, %edx
movl %edx, 0x88(%r14,%r15,4)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe91fc
incq %r15
addq $0x3, %r12
cmpq $0x100, %r15            # imm = 0x100
jne 0x1c409
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x38(%rsp), %r15
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
callq 0xf145f
movq 0x18(%rbx), %rdi
cmpb $0x0, 0x13(%rsp)
je 0x1c4a5
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbp, %rcx
movl %r15d, %r8d
callq 0x1c53d
jmp 0x1c4b7
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbp, %rcx
callq 0xef481
movq 0x78(%r14), %rsi
movq 0x80(%r14), %rdx
addl $0x3, %r13d
movq %rbx, %rdi
movl %r13d, %ecx
callq 0xf266a
movq %rax, %r15
movq 0x78(%r14), %rcx
addq $0x88, %r14
movl $0x0, (%rsp)
xorl %r12d, %r12d
movl $0x8, %edx
movq %rbp, %rdi
xorl %esi, %esi
movq %r14, %r8
movq %rax, %r9
callq 0xf2f79
cmpb $0x0, 0xd0(%rbx)
leaq 0x116a3f(%rip), %rsi    # 0x132f4b
cmoveq %r12, %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0xf22dc
testq %rbp, %rbp
je 0x1c527
movq %rbp, %rdi
callq 0xf052b
testq %r15, %r15
je 0x1c27b
movq %r15, %rdi
callq 0xf228d
jmp 0x1c27b