// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/ebml.c
// Function: do_element_sequence
static int do_element_sequence(deark *c, lctx *d, i64 pos1, i64 len)
{
	int ret;
	int retval = 0;
	i64 pos = pos1;
	int saved_indent_level;

	// TODO:
	// From the EBML spec:
	// "data that is not part of an EBML Element is permitted to be present
	// within a Master Element if unknownsizeallowed is enabled within the
	// definition for that Master Element. In this case, the EBML Reader
	// should skip data until a valid Element ID of the same EBMLParentPath or
	// the next upper level Element Path of the Master Element is found."
	//
	// We do not support this. We can't even detect it, so our parser will go
	// off the rails. How do you even support it efficiently? What kind of
	// psychopath designs a format like this? It's incredibly fragile (a new
	// format version that defines a new optional element will completely
	// break backward compatibility), and its abstractions are leaking all
	// over the place.

	d->level++;
	de_dbg_indent_save(c, &saved_indent_level);
	if(d->level > 16) goto done;
	if(len==0) { retval = 1; goto done; }

	de_dbg(c, "element sequence at %"I64_FMT", max_len=%"I64_FMT, pos1, len);
	de_dbg_indent(c, 1);

	while(1) {
		i64 ele_len = 0;
		if(pos >= pos1+len) {
			break;
		}
		ret = do_element(c, d, pos, pos1+len-pos, &ele_len);
		if(!ret) goto done;
		if(ele_len<1) goto done;

		pos += ele_len;
	}
	retval = 1;

done:
	de_dbg_indent_restore(c, saved_indent_level);
	d->level--;
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rcx, %rbp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
incl (%rsi)
leaq 0x40(%rsp), %rsi
callq 0xdebae
movq %rbx, 0x28(%rsp)
cmpl $0x11, (%rbx)
setge %al
testq %rbp, %rbp
sete %cl
orb %al, %cl
je 0x3f5e7
movl 0x40(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
movq 0x28(%rsp), %rax
decl (%rax)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xce473(%rip), %rsi     # 0x10da61
movq %r14, %rdi
movq %r12, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %r13
movq %r14, %rdi
movl %r13d, %esi
callq 0xdeba7
addq %r12, %rbp
movq %rbp, 0x48(%rsp)
movq %rbp, %rbx
subq %r12, %rbx
jle 0x3f5c2
movq %r12, 0x30(%rsp)
movq %r14, %rdi
leaq 0x44(%rsp), %rsi
callq 0xdebae
movq %r14, %rdi
leaq 0xce44d(%rip), %rsi     # 0x10da86
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
movl %r13d, %esi
callq 0xdeba7
movq 0x18(%r14), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rcx
callq 0x3fba3
cmpl $0x1, %eax
jne 0x3f6ba
movq 0x58(%rsp), %rdx
pushq $-0x20
popq %rax
leaq 0x143275(%rip), %rsi    # 0x1828f0
leaq 0x20(%rax), %r13
cmpq $0xd80, %r13            # imm = 0xD80
je 0x3f6d8
cmpq %rdx, 0x28(%rax,%rsi)
movq %r13, %rax
jne 0x3f67b
leaq (%rsi,%r13), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%r13,%rsi), %rcx
testq %rcx, %rcx
leaq 0xdf837(%rip), %rax     # 0x11eee1
cmoveq %rax, %rcx
movb (%r13,%rsi), %al
movq %rax, 0x20(%rsp)
jmp 0x3f6f1
movq %r14, %rdi
leaq 0xce3de(%rip), %rsi     # 0x10daa2
movq %r12, %rdx
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, %bl
xorl %r15d, %r15d
jmp 0x3f8b7
movq $0x0, 0x38(%rsp)
leaq 0xdf7f9(%rip), %rcx     # 0x11eee1
movq $0x0, 0x20(%rsp)
movq %r14, %rdi
leaq 0xce3cb(%rip), %rsi     # 0x10dac6
xorl %eax, %eax
callq 0xde896
movq 0x28(%rsp), %rax
cmpl $0x0, 0x4(%rax)
movq 0x30(%rsp), %rax
je 0x3f798
movq %rax, %rbp
subq %r12, %rbp
cmpq $0x8, %rbp
jg 0x3f798
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0xeac74
movq %rax, %rbx
testq %rbp, %rbp
movl $0x0, %eax
cmovleq %rax, %rbp
movq %r12, %r15
subq $0x1, %rbp
jb 0x3f76f
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3eb4
movzbl %al, %ecx
movq %rbx, %rdi
pushq $0x5
popq %rsi
leaq 0xce89f(%rip), %rdx     # 0x10e002
xorl %eax, %eax
callq 0xeae8b
incq %r15
jmp 0x3f741
movq %rbx, %rdi
callq 0xeb877
movq %r14, %rdi
leaq 0xce888(%rip), %rsi     # 0x10e009
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
callq 0xeaf3c
movq 0x10(%rsp), %rax
movq 0x18(%r14), %rdi
movq 0x48(%rsp), %rbp
movq %rbp, %rcx
subq %rax, %rcx
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x3fba3
movl %eax, %r15d
cmpl $0x2, %eax
je 0x3f7f2
cmpl $0x1, %r15d
jne 0x3f89a
movq 0x50(%rsp), %rcx
leaq 0xb0(%rsp), %rdi
pushq $0x50
popq %rsi
leaq 0xdcdc2(%rip), %rdx     # 0x11c5a1
movq %rcx, 0x10(%rsp)
xorl %eax, %eax
callq 0xde40c
movq 0x30(%rsp), %rbx
jmp 0x3f823
movq 0x18(%r14), %rax
movq 0x18(%rax), %rax
movq 0x30(%rsp), %rbx
subq %rbx, %rax
movq %rax, 0x10(%rsp)
movq %rax, 0x50(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xc5c61(%rip), %rsi     # 0x10547c
pushq $0x50
popq %rdx
callq 0xde492
movq 0x20(%rsp), %rax
decl %eax
leaq 0xdf6b0(%rip), %r8      # 0x11eee1
cmpb $0x7, %al
ja 0x3f846
movzbl %al, %eax
leaq 0xce1e9(%rip), %rcx     # 0x10da28
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
movq %r14, %rdi
leaq 0xce2ad(%rip), %rsi     # 0x10dafd
movq %rbx, %rdx
leaq 0xb0(%rsp), %rcx
xorl %eax, %eax
callq 0xde896
cmpl $0x2, %r15d
jne 0x3f87b
movq %r14, %rdi
leaq 0xce2a9(%rip), %rsi     # 0x10db1b
xorl %eax, %eax
callq 0xdf2a5
jmp 0x3f8ae
movq 0x10(%rsp), %r8
leaq (%r8,%rbx), %r15
movq 0x18(%r14), %rax
cmpq 0x18(%rax), %r15
jle 0x3f8dc
movq %r14, %rdi
leaq 0xce2bd(%rip), %rsi     # 0x10db55
jmp 0x3f8a4
movq %r14, %rdi
leaq 0xce231(%rip), %rsi     # 0x10dad5
movq %r12, %rdx
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, %bl
xorl %r15d, %r15d
pushq $0x1
popq %r13
movl 0x44(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
testb %bl, %bl
jne 0x3f5c2
addq %r15, %r12
testq %r15, %r15
jg 0x3f615
jmp 0x3f5c2
cmpq $0xd80, %r13            # imm = 0xD80
pushq $0x1
popq %r13
je 0x3faf0
movq 0x38(%rsp), %rax
movl (%rax), %eax
btl $0x9, %eax
jb 0x3faf0
btl $0x8, %eax
jae 0x3f90e
cmpl $0x2, (%r14)
jl 0x3f997
movq 0x38(%rsp), %rcx
movq 0x18(%rcx), %rcx
testq %rcx, %rcx
movq %rbx, 0x18(%rsp)
je 0x3f958
btl $0xb, %eax
setae 0xf(%rsp)
andq $0x0, 0x80(%rsp)
movq %rbx, 0x70(%rsp)
movq %r8, 0x78(%rsp)
movq %r14, %rdi
movq 0x28(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq *%rcx
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %rbx
jmp 0x3f95d
movb $0x1, 0xf(%rsp)
movzbl 0x20(%rsp), %eax
decl %eax
cmpl $0x7, %eax
ja 0x3fab9
leaq 0xce094(%rip), %rcx     # 0x10da08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r8, %rcx
callq 0x3f584
jmp 0x3faaf
movq %r14, %rdi
leaq 0xce1db(%rip), %rsi     # 0x10db7c
xorl %eax, %eax
callq 0xde896
jmp 0x3faf0
movq %r14, %rdi
movq %rbx, %rsi
movq %r8, %rdx
movl $0x401, %ecx            # imm = 0x401
jmp 0x3faaa
cmpq $0x8, %r8
jne 0x3fab9
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0xe4143
movq %rax, %rbx
cqto
movl $0x3b9aca00, %ecx       # imm = 0x3B9ACA00
idivq %rcx
movq %rdx, 0x20(%rsp)
leaq 0x3a4fc880(%rax), %rdi
leaq 0x60(%rsp), %rsi
movl %r13d, %edx
callq 0xe002e
cvtsi2sdq 0x20(%rsp), %xmm0
divsd 0xcdff5(%rip), %xmm0    # 0x10da00
leaq 0x60(%rsp), %rdi
callq 0xe0071
leaq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movq %r14, %rdi
leaq 0xc5d5a(%rip), %rsi     # 0x10578d
movq %rbx, %rdx
leaq 0x70(%rsp), %rcx
xorl %eax, %eax
callq 0xde896
jmp 0x3faaf
testq %r8, %r8
je 0x3fb16
leaq -0x9(%r8), %rax
cmpq $-0x8, %rax
jb 0x3fab9
leaq -0x8(,%r8,8), %rdi
movq %r8, %rbp
movq %rbx, %r13
xorl %ebx, %ebx
subq $0x1, %rbp
jb 0x3fb3b
movq %rdi, 0x20(%rsp)
movq 0x18(%r14), %rdi
movq %r13, %rsi
callq 0xe3eb4
movq 0x20(%rsp), %rdi
movzbl %al, %eax
movl %edi, %ecx
andb $-0x8, %cl
shlq %cl, %rax
orq %rax, %rbx
addq $-0x8, %rdi
incq %r13
jmp 0x3fa67
movq %r14, %rdi
movq %rbx, %rsi
movq %r8, %rdx
pushq $0x2
popq %rcx
callq 0x3fc65
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %rbx
cmpb $0x0, 0xf(%rsp)
jne 0x3faf0
andq $0x0, 0x80(%rsp)
movq %rbx, 0x70(%rsp)
movq %r8, 0x78(%rsp)
movb $0x1, 0x80(%rsp)
movq %r14, %rdi
movq 0x28(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq 0x38(%rsp), %rax
callq *0x18(%rax)
subq %r12, %r15
xorl %ebx, %ebx
jmp 0x3f8b7
cmpq $0x8, %r8
je 0x3fb1a
cmpq $0x4, %r8
jne 0x3fab9
movq 0x18(%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xe4470
jmp 0x3fb28
xorl %ebx, %ebx
jmp 0x3fb44
movq 0x18(%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xe451a
movq %r14, %rdi
leaq 0xce504(%rip), %rsi     # 0x10e036
movb $0x1, %al
callq 0xde896
jmp 0x3fb58
movq 0x48(%rsp), %rbp
pushq $0x1
popq %r13
movq %r14, %rdi
leaq 0xce4dd(%rip), %rsi     # 0x10e02b
movq %rbx, %rdx
xorl %eax, %eax
callq 0xde896
cmpb $0x0, 0xf(%rsp)
movq 0x18(%rsp), %rbx
movq 0x10(%rsp), %r8
je 0x3fac0
jmp 0x3faf0