// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0xfc(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
subl $0x4c495354, %eax       # imm = 0x4C495354
je 0x11ef88
jmp 0x11ef70
movl -0x3c(%rbp), %eax
subl $0x52494646, %eax       # imm = 0x52494646
je 0x11ef88
jmp 0x11ef7c
movl -0x3c(%rbp), %eax
subl $0x52494658, %eax       # imm = 0x52494658
jne 0x11efa2
jmp 0x11ef88
movq -0x10(%rbp), %rax
movl $0x1, 0x134(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x11f41a
cmpl $0x494e464f, -0x24(%rbp) # imm = 0x494E464F
jne 0x11efe6
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movl 0x4(%rax), %r9d
callq 0x11f730
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f413
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x40(%rbp)
subl $0x44495350, %eax       # imm = 0x44495350
je 0x11f0d7
jmp 0x11f004
movl -0x40(%rbp), %eax
subl $0x45584946, %eax       # imm = 0x45584946
je 0x11f12f
jmp 0x11f014
movl -0x40(%rbp), %eax
subl $0x49434350, %eax       # imm = 0x49434350
je 0x11f103
jmp 0x11f024
movl -0x40(%rbp), %eax
subl $0x584d5020, %eax       # imm = 0x584D5020
je 0x11f15b
jmp 0x11f034
movl -0x40(%rbp), %eax
subl $0x5f504d58, %eax       # imm = 0x5F504D58
je 0x11f15b
jmp 0x11f044
movl -0x40(%rbp), %eax
subl $0x61766968, %eax       # imm = 0x61766968
je 0x11f320
jmp 0x11f054
movl -0x40(%rbp), %eax
subl $0x626d6864, %eax       # imm = 0x626D6864
je 0x11f187
jmp 0x11f064
movl -0x40(%rbp), %eax
subl $0x626d7020, %eax       # imm = 0x626D7020
je 0x11f3ce
jmp 0x11f074
movl -0x40(%rbp), %eax
subl $0x64617461, %eax       # imm = 0x64617461
je 0x11f1f0
jmp 0x11f084
movl -0x40(%rbp), %eax
subl $0x66616374, %eax       # imm = 0x66616374
je 0x11f2e4
jmp 0x11f094
movl -0x40(%rbp), %eax
subl $0x666d7420, %eax       # imm = 0x666D7420
je 0x11f2a8
jmp 0x11f0a4
movl -0x40(%rbp), %eax
subl $0x69636f6e, %eax       # imm = 0x69636F6E
je 0x11f1b4
jmp 0x11f0b4
movl -0x40(%rbp), %eax
subl $0x73747266, %eax       # imm = 0x73747266
je 0x11f395
jmp 0x11f0c4
movl -0x40(%rbp), %eax
subl $0x73747268, %eax       # imm = 0x73747268
je 0x11f35c
jmp 0x11f411
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11f830
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11f920
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11f970
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11f9b0
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
cmpl $0x52444942, -0x24(%rbp) # imm = 0x52444942
jne 0x11f1af
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x11fa00
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x10(%rbp), %rax
cmpl $0x41434f4e, 0x9c(%rax) # imm = 0x41434F4E
jne 0x11f1eb
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11fa40
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
cmpl $0x524d4944, -0x24(%rbp) # imm = 0x524D4944
jne 0x11f23d
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
leaq 0xa6aed(%rip), %r9      # 0x1c5d01
xorl %eax, %eax
xorl %eax, %eax
movq $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x11fb10
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f2a3
cmpl $0x50414c20, -0x24(%rbp) # imm = 0x50414C20
jne 0x11f26f
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11fb60
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f2a1
cmpl $0x52444942, -0x24(%rbp) # imm = 0x52444942
jne 0x11f29f
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11fd80
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f2a1
jmp 0x11f2a3
jmp 0x11f411
movq -0x10(%rbp), %rax
cmpl $0x57415645, 0x9c(%rax) # imm = 0x57415645
jne 0x11f2df
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11fe80
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x10(%rbp), %rax
cmpl $0x57415645, 0x9c(%rax) # imm = 0x57415645
jne 0x11f31b
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11fec0
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x10(%rbp), %rax
cmpl $0x41564920, 0x9c(%rax) # imm = 0x41564920
jne 0x11f357
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x11ff30
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x10(%rbp), %rax
cmpl $0x41564920, 0x9c(%rax) # imm = 0x41564920
jne 0x11f393
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x120070
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x10(%rbp), %rax
cmpl $0x41564920, 0x9c(%rax) # imm = 0x41564920
jne 0x11f3cc
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x120130
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
movq -0x38(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x11f40f
movq -0x10(%rbp), %rax
cmpl $0x626d7074, 0xfc(%rax) # imm = 0x626D7074
jne 0x11f40f
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x1201c0
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
jmp 0x11f411
jmp 0x11f413
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)