// File: /workspace/github_c_makefile_star2_O3/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 0xeed0d
movq %rax, %r15
movq (%r14), %rdi
movq 0x28(%r14), %r12
leaq 0x4(%r12), %rbx
leaq 0x83e08(%rip), %rsi     # 0x13714c
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
leaq (%r12,%r15), %rbp
addq $0x4, %rbp
movq 0x10(%r14), %rax
cmpq 0x18(%rax), %rbp
jle 0xb336d
movb $0x1, 0x38(%r14)
jmp 0xb3528
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 0xb3404
movl $0x70, %esi
movq %r15, %rdi
callq 0xe8b2b
movq %rax, %r12
leaq 0x7db49(%rip), %rax     # 0x130efc
movq %rax, (%r12)
orb $0x1, 0x8(%r12)
movq 0x18(%r15), %rcx
leaq 0x83e0c(%rip), %rsi     # 0x1371d4
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %r8
movq %r14, %r9
callq 0xe9aa3
movb 0x40(%r12), %r13b
movq %r15, %rdi
movq %r12, %rsi
callq 0xe8be2
testb $0x1, %r13b
jne 0xb34a5
leaq 0x83d6c(%rip), %rsi     # 0x137166
movq %r15, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xeed0d
movq %rax, %r13
leaq 0x83d8c(%rip), %rsi     # 0x1371a6
xorl %r12d, %r12d
movq %r15, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
subq %r13, %r14
jl 0xb3520
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 0xf1762
leaq 0x18(%rsp), %rdx
leaq 0x86f4b(%rip), %rsi     # 0x13a3af
movq %r15, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r15), %rdi
leaq 0x2c(%rbx), %rsi
callq 0xeed0d
movq %rax, %r13
leaq 0x83d38(%rip), %rsi     # 0x1371bd
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
testq %r13, %r13
cmovneq %r13, %r14
leaq (%r14,%r12), %rax
cmpq %rbp, %rax
jle 0xb34aa
xorl %r12d, %r12d
jmp 0xb3520
movq %r12, %r13
leaq 0x83d20(%rip), %rsi     # 0x1371d4
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r12
movq (%rsp), %rbp
movq %rbp, %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0xf1026
movl $0x69647363, %esi       # imm = 0x69647363
movq %r12, %rdi
callq 0xf1026
movq 0x18(%r15), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0xef481
leaq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0xf1026
movl $0x69646174, %esi       # imm = 0x69646174
movq %r12, %rdi
callq 0xf1026
movq 0x18(%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xef481
movq %r12, %rdi
callq 0xf052b
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq