// File: /workspace/github_c_makefile_star2_O2/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 0xe404f
movq %rax, %r15
movq (%r14), %rdi
movq 0x28(%r14), %r12
leaq 0x4(%r12), %rbx
leaq 0x7d495(%rip), %rsi     # 0x129e4c
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
leaq (%r12,%r15), %rbp
addq $0x4, %rbp
movq 0x10(%r14), %rax
cmpq 0x18(%rax), %rbp
jle 0xac9e0
movb $0x1, 0x38(%r14)
jmp 0xacb97
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 0xaca75
pushq $0x70
popq %rsi
movq %r15, %rdi
callq 0xdecaf
movq %rax, %r12
leaq 0x771f5(%rip), %rax     # 0x123c19
movq %rax, (%r12)
orb $0x1, 0x8(%r12)
movq 0x18(%r15), %rcx
leaq 0x7d49b(%rip), %rsi     # 0x129ed4
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %r8
movq %r14, %r9
callq 0xdf9b8
movb 0x40(%r12), %r13b
movq %r15, %rdi
movq %r12, %rsi
callq 0xded32
testb $0x1, %r13b
jne 0xacb14
leaq 0x7d3fb(%rip), %rsi     # 0x129e66
movq %r15, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xe404f
movq %rax, %r13
leaq 0x7d41b(%rip), %rsi     # 0x129ea6
xorl %r12d, %r12d
movq %r15, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
subq %r13, %r14
jl 0xacb8f
movq %r13, (%rsp)
leaq (%rbx,%r13), %r12
movq 0x18(%r15), %rdi
leaq 0x4(%rbx), %rsi
leaq 0x8(%rsp), %rdx
pushq $0x4
popq %rcx
xorl %r8d, %r8d
callq 0xe657c
leaq 0x18(%rsp), %rdx
leaq 0x805e8(%rip), %rsi     # 0x12d0bb
movq %r15, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%r15), %rdi
leaq 0x2c(%rbx), %rsi
callq 0xe404f
movq %rax, %r13
leaq 0x7d3c9(%rip), %rsi     # 0x129ebd
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
testq %r13, %r13
cmovneq %r13, %r14
leaq (%r14,%r12), %rax
cmpq %rbp, %rax
jle 0xacb19
xorl %r12d, %r12d
jmp 0xacb8f
movq %r12, %r13
leaq 0x7d3b1(%rip), %rsi     # 0x129ed4
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r12
movq (%rsp), %rbp
movq %rbp, %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0xe5f65
movl $0x69647363, %esi       # imm = 0x69647363
movq %r12, %rdi
callq 0xe5f65
movq 0x18(%r15), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0xe45f4
leaq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0xe5f65
movl $0x69646174, %esi       # imm = 0x69646174
movq %r12, %rdi
callq 0xe5f65
movq 0x18(%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xe45f4
movq %r12, %rdi
callq 0xe5591
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq