// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/rodraw.c
// Function: do_object_sequence
static int do_object_sequence(deark *c, lctx *d, i64 pos1, i64 len)
{
	i64 pos = pos1;

	d->nesting_level++;
	if(d->nesting_level>16) goto done;

	while(1) {
		struct objinfo oi;

		de_zeromem(&oi, sizeof(struct objinfo));
		oi.objpos = pos;
		if((oi.objpos+24) > (pos1+len)) break;
		oi.objtype = (u32)de_getu32le_p(&pos);
		oi.objsize = de_getu32le_p(&pos);
		if(oi.objsize<8 || (oi.objpos+oi.objsize)>(pos1+len)) {
			de_err(c, "Bad object size (%u) at %"I64_FMT, (unsigned int)oi.objsize, oi.objpos);
			goto done;
		}

		get_objtype_info(&oi);

		de_dbg(c, "object at %"I64_FMT", type=%u (%s), len=%"I64_FMT, oi.objpos,
			oi.objtype, oi.tyname, oi.objsize);

		if(oi.hasbbox) {
			pos += 16;
		}
		oi.dpos = pos;
		oi.dlen = oi.objpos+oi.objsize - oi.dpos;
		if(oi.dlen<0) goto done_obj;

		de_dbg_indent(c, 1);
		do_object(c, d, &oi);
		de_dbg_indent(c, -1);

done_obj:
		pos = oi.objpos + oi.objsize;
	}

done:
	d->nesting_level--;
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movq %rsi, %rbx
movq %rdx, 0x38(%rsp)
movl 0x8(%rsi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x8(%rsi)
cmpl $0xf, %eax
jg 0xd9d6d
movq %rdx, %rbp
movq %rdi, %r14
addq %rdx, %r15
movq %rbx, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, (%rsp)
movq %rbp, 0x10(%rsp)
leaq 0x18(%rbp), %rax
cmpq %r15, %rax
jg 0xd9d68
movq 0x18(%r14), %rdi
leaq 0x38(%rsp), %r12
movq %r12, %rsi
callq 0xe40bf
movq %rax, %r13
movl %r13d, (%rsp)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe40bf
movq %rax, 0x8(%rsp)
cmpq $0x8, %rax
jl 0xd9d52
movq %rax, %r12
addq %rbp, %r12
cmpq %r15, %r12
jg 0xd9d52
cmpl $0xd, %r13d
ja 0xd9c29
movl %r13d, %ecx
leaq 0x5e68d(%rip), %rdx     # 0x1382a4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x5e735(%rip), %r8      # 0x13835c
jmp 0xd9c42
cmpl $0x10065, %r13d         # imm = 0x10065
jne 0xd9c3b
leaq 0x5e776(%rip), %r8      # 0x1383af
jmp 0xd9c42
leaq 0x4529f(%rip), %r8      # 0x11eee1
movq %r8, 0x28(%rsp)
movb $0x1, %bl
jmp 0xd9cb2
leaq 0x5e723(%rip), %r8      # 0x138375
jmp 0xd9ca3
leaq 0x5e70c(%rip), %r8      # 0x138367
jmp 0xd9ca3
leaq 0x5e744(%rip), %r8      # 0x1383a8
jmp 0xd9ca3
leaq 0x4c31a(%rip), %r8      # 0x125f87
jmp 0xd9ca3
leaq 0x5e709(%rip), %r8      # 0x13837f
jmp 0xd9ca3
leaq 0x40dfc(%rip), %r8      # 0x11aa7b
jmp 0xd9ca3
leaq 0x5e714(%rip), %r8      # 0x13839c
jmp 0xd9ca3
leaq 0x45dfa(%rip), %r8      # 0x11fa8b
jmp 0xd9ca3
leaq 0x5e6f1(%rip), %r8      # 0x13838b
jmp 0xd9ca3
leaq 0x42250(%rip), %r8      # 0x11bef3
movq %r8, 0x28(%rsp)
movl $0x1, 0x4(%rsp)
xorl %ebx, %ebx
movq %r14, %rdi
leaq 0x5e67b(%rip), %rsi     # 0x138337
movq %rbp, %rdx
movl %r13d, %ecx
movq %rax, %r9
xorl %eax, %eax
callq 0xde896
movq 0x38(%rsp), %rbp
testb %bl, %bl
jne 0xd9cde
addq $0x10, %rbp
movq %rbp, 0x38(%rsp)
movq %rbp, 0x18(%rsp)
movq %r12, %rbx
subq %rbp, %rbx
movq %rbx, 0x20(%rsp)
js 0xd9d40
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
cmpl $0x5, %r13d
je 0xd9d2a
cmpl $0xd, %r13d
je 0xd9d2a
cmpl $0x6, %r13d
jne 0xd9d35
addq $0xc, %rbp
addq $-0xc, %rbx
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0xd9b69
jmp 0xd9d35
movq %r14, %rdi
movq %rsp, %rsi
callq 0xd9d7f
movq %r14, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq %r12, 0x38(%rsp)
movq %r12, %rbp
movq 0x40(%rsp), %rbx
jmp 0xd9ba2
leaq 0x5e5c2(%rip), %rsi     # 0x13831b
movq %r14, %rdi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xdf2a5
movl 0x8(%rbx), %eax
decl %eax
movl %eax, 0x8(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq