// File: /workspace/github_c_makefile_star2_O1/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 %rdx, 0x38(%rsp)
movl 0x8(%rsi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x8(%rsi)
cmpl $0xf, %eax
jg 0xe43b6
movq %rdi, %r14
movq %rsi, 0x40(%rsp)
addq %rdx, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, (%rsp)
movq 0x38(%rsp), %r12
movq %r12, 0x10(%rsp)
leaq 0x18(%r12), %rax
cmpq %r15, %rax
jg 0xe43b1
movq 0x18(%r14), %rdi
leaq 0x38(%rsp), %rbx
movq %rbx, %rsi
callq 0xef3a0
movq %rax, %r13
movl %r13d, (%rsp)
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0xef3a0
movq %rax, %rbx
movq %rax, 0x8(%rsp)
cmpq $0x8, %rax
jl 0xe439b
movq %rbx, %rbp
addq %r12, %rbp
cmpq %r15, %rbp
jg 0xe439b
cmpl $0xd, %r13d
ja 0xe4266
movl %r13d, %eax
leaq 0x60fc0(%rip), %rcx     # 0x145214
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x61068(%rip), %rax     # 0x1452cc
jmp 0xe4276
cmpl $0x10065, %r13d         # imm = 0x10065
jne 0xe42e2
leaq 0x610a9(%rip), %rax     # 0x14531f
movq %rax, 0x28(%rsp)
jmp 0xe42e2
leaq 0x61061(%rip), %rax     # 0x1452e5
jmp 0xe42d5
leaq 0x6104a(%rip), %rax     # 0x1452d7
jmp 0xe42d5
leaq 0x61082(%rip), %rax     # 0x145318
jmp 0xe42d5
leaq 0x4ebc8(%rip), %rax     # 0x132e67
jmp 0xe42d5
leaq 0x61047(%rip), %rax     # 0x1452ef
jmp 0xe42d5
leaq 0x437da(%rip), %rax     # 0x127a8b
jmp 0xe42d5
leaq 0x61052(%rip), %rax     # 0x14530c
jmp 0xe42d5
leaq 0x48750(%rip), %rax     # 0x12ca13
jmp 0xe42d5
leaq 0x6102f(%rip), %rax     # 0x1452fb
jmp 0xe42d5
leaq 0x44c2e(%rip), %rax     # 0x128f03
movq %rax, 0x28(%rsp)
movl $0x1, 0x4(%rsp)
movq 0x28(%rsp), %r8
testq %r8, %r8
leaq 0x47b78(%rip), %rax     # 0x12be69
cmoveq %rax, %r8
movq %r8, 0x28(%rsp)
movq %r14, %rdi
leaq 0x60fa3(%rip), %rsi     # 0x1452a7
movq %r12, %rdx
movl %r13d, %ecx
movq %rbx, %r9
xorl %eax, %eax
callq 0xe9226
cmpl $0x0, 0x4(%rsp)
je 0xe4321
addq $0x10, 0x38(%rsp)
movq 0x38(%rsp), %r12
movq %r12, 0x18(%rsp)
subq %r12, %rbp
movq %rbp, 0x20(%rsp)
js 0xe4389
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
cmpl $0x5, %r13d
je 0xe4371
cmpl $0xd, %r13d
je 0xe4371
cmpl $0x6, %r13d
jne 0xe437c
addq $0xc, %r12
addq $-0xc, %rbp
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0xe41a3
jmp 0xe437c
movq %r14, %rdi
movq %rsp, %rsi
callq 0xe43c8
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x10(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x38(%rsp)
jmp 0xe41d6
leaq 0x60ee9(%rip), %rsi     # 0x14528b
movq %r14, %rdi
movl %ebx, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9df7
movq 0x40(%rsp), %rsi
decl 0x8(%rsi)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq