// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pict.c
// Function: handler_QuickTime
static void handler_QuickTime(struct item_handler_data *h)
{
	i64 payload_pos;
	i64 payload_len;
	i64 endpos;
	i64 idsc_pos;

	payload_len = dbuf_getu32be(h->inf, h->data_pos);
	payload_pos = h->data_pos+4;
	de_dbg(h->c, "payload: pos=%"I64_FMT", len=%"I64_FMT, payload_pos, payload_len);
	endpos = payload_pos+payload_len;
	if(endpos > h->inf->len) {
		h->fatal_errflag = 1;
		return;
	}
	h->data_len = 4+payload_len;

	// Following the size field seems to be 68 or 50 bytes of data,
	// followed by QuickTime "idsc" data, followed by image data.
	idsc_pos = payload_pos + ((h->opcode==0x8201) ? 50 : 68);

	do_handle_qtif_idsc(h->c, h->d, idsc_pos, endpos-idsc_pos);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movq 0x10(%rdi), %rdi
movq 0x28(%r14), %rsi
callq 0xef32a
movq %rax, %r15
movq (%r14), %rdi
movq 0x28(%r14), %r12
leaq 0x4(%r12), %rbx
leaq 0x82ee1(%rip), %rsi     # 0x136d82
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
leaq (%r12,%r15), %rbp
addq $0x4, %rbp
movq 0x10(%r14), %rax
cmpq 0x18(%rax), %rbp
jle 0xb3eca
movb $0x1, 0x38(%r14)
jmp 0xb4085
addq $0x4, %r15
movq %r15, 0x30(%r14)
leaq 0x44(%rbx), %rax
addq $0x32, %rbx
cmpl $0x8201, 0x18(%r14)     # imm = 0x8201
cmovneq %rax, %rbx
movq (%r14), %r15
movq 0x8(%r14), %rax
movq %rbp, %r14
subq %rbx, %r14
cmpl $0x0, 0x14(%rax)
je 0xb3f61
movl $0x70, %esi
movq %r15, %rdi
callq 0xe969b
movq %rax, %r12
leaq 0x7ccb1(%rip), %rax     # 0x130bc1
movq %rax, (%r12)
orb $0x1, 0x8(%r12)
movq 0x18(%r15), %rcx
leaq 0x82ee5(%rip), %rsi     # 0x136e0a
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %r8
movq %r14, %r9
callq 0xea5fa
movb 0x40(%r12), %r13b
movq %r15, %rdi
movq %r12, %rsi
callq 0xe9752
testb $0x1, %r13b
jne 0xb4002
leaq 0x82e45(%rip), %rsi     # 0x136d9c
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xef32a
movq %rax, %r13
leaq 0x82e65(%rip), %rsi     # 0x136ddc
xorl %r12d, %r12d
movq %r15, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
subq %r13, %r14
jl 0xb407d
movq %r13, (%rsp)
leaq (%rbx,%r13), %r12
movq 0x18(%r15), %rdi
leaq 0x4(%rbx), %rsi
leaq 0x8(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
leaq 0x18(%rsp), %rdx
leaq 0x8606a(%rip), %rsi     # 0x13a02b
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r15), %rdi
leaq 0x2c(%rbx), %rsi
callq 0xef32a
movq %rax, %r13
leaq 0x82e11(%rip), %rsi     # 0x136df3
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
testq %r13, %r13
cmovneq %r13, %r14
leaq (%r14,%r12), %rax
cmpq %rbp, %rax
jle 0xb4007
xorl %r12d, %r12d
jmp 0xb407d
movq %r12, %r13
leaq 0x82df9(%rip), %rsi     # 0x136e0a
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r12
movq (%rsp), %rbp
movq %rbp, %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0xf1629
movl $0x69647363, %esi       # imm = 0x69647363
movq %r12, %rdi
callq 0xf1629
movq 0x18(%r15), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0xefabc
leaq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0xf1629
movl $0x69646174, %esi       # imm = 0x69646174
movq %r12, %rdi
callq 0xf1629
movq 0x18(%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xefabc
movq %r12, %rdi
callq 0xf0b13
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq