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

	list_type = ictx->curr_container_contentstype4cc.id;
	dpos = ictx->chunkctx->dpos;
	dlen = ictx->chunkctx->dlen;

	switch(ictx->chunkctx->chunk4cc.id) {
	case CHUNK_RIFF:
	case CHUNK_RIFX:
	case CHUNK_LIST:
		ictx->is_std_container = 1;
		return 1;
	}

	if(list_type==CODE_INFO) {
		do_INFO_item(c, d, ictx, dpos, dlen, ictx->chunkctx->chunk4cc.id);
		ictx->handled = 1;
		goto done;
	}

	switch(ictx->chunkctx->chunk4cc.id) {

	case CHUNK_DISP:
		do_DISP(c, d, ictx, dpos, dlen);
		ictx->handled = 1;
		break;

	case CHUNK_ICCP: // Used by WebP
		do_ICCP(c, d, ictx, dpos, dlen);
		ictx->handled = 1;
		break;

	case CHUNK_EXIF: // Used by WebP
		do_EXIF(c, d, ictx, dpos, dlen);
		ictx->handled = 1;
		break;

	case CHUNK_XMP: // Used by WebP
	case CHUNK__PMX: // Used by WAVE, AVI
		do_XMP(c, d, ictx, dpos, dlen);
		ictx->handled = 1;
		break;

	case CHUNK_bmhd:
		if(list_type==CODE_RDIB) {
			do_RDIB_bmhd(c, d, ictx);
			ictx->handled = 1;
		}
		break;

	case CHUNK_icon:
		if(ictx->main_contentstype4cc.id==CODE_ACON) {
			extract_ani_frame(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_data:
		if(list_type==CODE_RMID) {
			do_extract_raw(c, d, ictx, dpos, dlen, "mid", NULL, 0);
			ictx->handled = 1;
		}
		else if(list_type==CODE_PAL) {
			do_palette(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		else if(list_type==CODE_RDIB) {
			do_RDIB_data(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_fmt:
		if(ictx->main_contentstype4cc.id==CODE_WAVE) {
			do_wav_fmt(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_fact:
		if(ictx->main_contentstype4cc.id==CODE_WAVE) {
			do_wav_fact(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_avih:
		if(ictx->main_contentstype4cc.id==CODE_AVI) {
			do_avi_avih(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_strh:
		if(ictx->main_contentstype4cc.id==CODE_AVI) {
			do_avi_strh(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_strf:
		if(ictx->main_contentstype4cc.id==CODE_AVI) {
			do_avi_strf(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;

	case CHUNK_bmp:
		if(d->is_cdr && ictx->curr_container_contentstype4cc.id==CODE_bmpt) {
			do_cdr_bmp(c, d, ictx, dpos, dlen);
			ictx->handled = 1;
		}
		break;
	}

done:
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x128(%rdi), %rcx
movl 0x4(%rcx), %r14d
cmpl $0x4c495354, %r14d      # imm = 0x4C495354
je 0xc2968
cmpl $0x52494658, %r14d      # imm = 0x52494658
je 0xc2968
cmpl $0x52494646, %r14d      # imm = 0x52494646
jne 0xc2977
movl $0x1, 0x134(%rbx)
jmp 0xc2b76
movq (%rbx), %r12
movq 0x10(%rbx), %rsi
movl 0xfc(%rbx), %eax
movq 0x40(%rcx), %r13
movq 0x48(%rcx), %r15
cmpl $0x494e464f, %eax       # imm = 0x494E464F
jne 0xc2a0b
movq %rsi, 0x10(%rsp)
movq %r12, %rdi
callq 0xf6870
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movl 0x60(%rbx), %eax
movl %eax, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r13, %rsi
movq %r15, %rdx
movq %rbp, %r8
movl $0x1, %r9d
callq 0xf0203
movq %rbp, %rdi
callq 0xf7557
leaq 0x4fd86(%rip), %rsi     # 0x11275b
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
cmpl $0x494e414d, %r14d      # imm = 0x494E414D
jne 0xc2b64
movq 0x10(%rsp), %r14
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0xc2b38
callq 0xf6883
jmp 0xc2b44
cmpl $0x626d701f, %r14d      # imm = 0x626D701F
jg 0xc2a54
cmpl $0x584d501f, %r14d      # imm = 0x584D501F
jle 0xc2aae
cmpl $0x61766967, %r14d      # imm = 0x61766967
jg 0xc2b8a
cmpl $0x584d5020, %r14d      # imm = 0x584D5020
je 0xc2a44
cmpl $0x5f504d58, %r14d      # imm = 0x5F504D58
jne 0xc2b76
movq 0x18(%rbx), %rdi
leaq 0x74d07(%rip), %rcx     # 0x137756
jmp 0xc2ae0
cmpl $0x666d741f, %r14d      # imm = 0x666D741F
jle 0xc2af6
cmpl $0x73747265, %r14d      # imm = 0x73747265
jg 0xc2bb2
cmpl $0x666d7420, %r14d      # imm = 0x666D7420
je 0xc2be3
cmpl $0x69636f6e, %r14d      # imm = 0x69636F6E
jne 0xc2b76
cmpl $0x41434f4e, 0x9c(%rbx) # imm = 0x41434F4E
jne 0xc2b76
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xc3079
jmp 0xc2b6c
cmpl $0x44495350, %r14d      # imm = 0x44495350
je 0xc2c4e
cmpl $0x45584946, %r14d      # imm = 0x45584946
je 0xc2c9c
cmpl $0x49434350, %r14d      # imm = 0x49434350
jne 0xc2b76
movq 0x18(%rbx), %rdi
leaq 0x5300d(%rip), %rcx     # 0x115aed
movq %r13, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xf0321
jmp 0xc2b6c
cmpl $0x626d7020, %r14d      # imm = 0x626D7020
je 0xc2c64
cmpl $0x64617461, %r14d      # imm = 0x64617461
je 0xc2caf
cmpl $0x66616374, %r14d      # imm = 0x66616374
jne 0xc2b76
cmpl $0x57415645, 0x9c(%rbx) # imm = 0x57415645
jne 0xc2b76
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xc3333
jmp 0xc2b6c
movq %r12, %rdi
callq 0xf6870
movq %rax, 0x18(%r14)
cmpq $0x41, 0x10(%rbp)
jl 0xc2b58
movl $0x40, %esi
movq %rbp, %rdi
callq 0xf688a
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xf6969
movq %rbp, %rdi
callq 0xf6bb0
movl $0x1, 0x130(%rbx)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x61766968, %r14d      # imm = 0x61766968
je 0xc2c05
cmpl $0x626d6864, %r14d      # imm = 0x626D6864
jne 0xc2b76
cmpl $0x52444942, %eax       # imm = 0x52444942
jne 0xc2b76
movq 0x50(%rcx), %rax
testq %rax, %rax
je 0xc2b6c
orb $0x1, 0x60(%rax)
jmp 0xc2b6c
cmpl $0x73747266, %r14d      # imm = 0x73747266
je 0xc2c28
cmpl $0x73747268, %r14d      # imm = 0x73747268
jne 0xc2b76
cmpl $0x41564920, 0x9c(%rbx) # imm = 0x41564920
jne 0xc2b76
movq %r12, %rdi
movq %rbx, %rdx
movq %r13, %rcx
movq %r15, %r8
callq 0xc3425
jmp 0xc2b6c
cmpl $0x57415645, 0x9c(%rbx) # imm = 0x57415645
jne 0xc2b76
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xc3501
jmp 0xc2b6c
cmpl $0x41564920, 0x9c(%rbx) # imm = 0x41564920
jne 0xc2b76
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xc3364
jmp 0xc2b6c
cmpl $0x41564920, 0x9c(%rbx) # imm = 0x41564920
jne 0xc2b76
movq %r12, %rdi
movq %rbx, %rdx
movq %r13, %rcx
movq %r15, %r8
callq 0xc34c2
jmp 0xc2b6c
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xc2f36
jmp 0xc2b6c
cmpl $0x0, 0x4(%rsi)
setne %cl
cmpl $0x626d7074, %eax       # imm = 0x626D7074
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0xc2b76
cmpq $0x14, %r15
jl 0xc2b6c
movq 0x18(%rbx), %rdi
addq $0x2, %r13
addq $-0x2, %r15
leaq 0x5e3b8(%rip), %rcx     # 0x121052
jmp 0xc2cd3
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xf7eab
jmp 0xc2b6c
cmpl $0x50414c20, %eax       # imm = 0x50414C20
je 0xc2cfa
cmpl $0x52444942, %eax       # imm = 0x52444942
je 0xc2ce4
cmpl $0x524d4944, %eax       # imm = 0x524D4944
jne 0xc2b76
movq 0x18(%rbx), %rdi
leaq 0x77407(%rip), %rcx     # 0x13a0da
movq %r13, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
jmp 0xc2aef
movq %r12, %rdi
movq %rbx, %rdx
movq %r13, %rcx
movq %r15, %r8
callq 0xc328f
jmp 0xc2b6c
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xc3103
jmp 0xc2b6c