// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rdx, %rbp
movq %rsi, %rbx
movq %rdi, %r14
incl (%rsi)
leaq 0x44(%rsp), %rsi
callq 0xe8a1c
movq %rbx, 0x28(%rsp)
cmpl $0x11, (%rbx)
setge %al
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x41922
leaq 0xd97ea(%rip), %rsi     # 0x11ab51
movq %r14, %rdi
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
addq %rbp, %r15
movq %r15, 0x48(%rsp)
movq %r15, %rbx
subq %rbp, %rbx
jle 0x41922
movq %rbp, 0x38(%rsp)
movq %r14, %rdi
leaq 0x40(%rsp), %rsi
callq 0xe8a1c
movq %r14, %rdi
leaq 0xd97c2(%rip), %rsi     # 0x11ab76
movq %rbp, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%r14), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rcx
callq 0x4197e
cmpl $0x1, %eax
jne 0x418d5
movq 0x58(%rsp), %r8
xorl %eax, %eax
leaq 0x13e4b5(%rip), %rdx    # 0x17f8b0
movq %rbp, 0x30(%rsp)
movq 0x8(%rax,%rdx), %r12
cmpq %r8, %r12
je 0x4142a
addq $0x20, %rax
cmpq $0xd80, %rax            # imm = 0xD80
jne 0x41400
xorl %ebx, %ebx
leaq 0xead32(%rip), %rcx     # 0x12c151
movq $0x0, 0x10(%rsp)
jmp 0x41449
leaq (%rdx,%rax), %rbx
movq 0x10(%rax,%rdx), %rcx
testq %rcx, %rcx
leaq 0xead14(%rip), %rsi     # 0x12c151
cmoveq %rsi, %rcx
movb (%rax,%rdx), %al
movq %rax, 0x10(%rsp)
movq %r14, %rdi
leaq 0xd9763(%rip), %rsi     # 0x11abb6
movq %r8, 0x20(%rsp)
movq %r8, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x28(%rsp), %rax
cmpl $0x0, 0x4(%rax)
movq 0x38(%rsp), %rbp
je 0x414fd
movq %rbp, %r15
subq 0x30(%rsp), %r15
cmpq $0x8, %r15
jg 0x414fd
movq %rbx, 0x18(%rsp)
movq %r14, %rdi
callq 0xf6410
movq %rax, %rbx
testq %r15, %r15
movq %r14, %r13
leaq 0xd9c51(%rip), %r14     # 0x11b0f2
jle 0x414d1
movq 0x30(%rsp), %r15
movq 0x18(%r13), %rdi
movq %r15, %rsi
callq 0xeead3
movzbl %al, %ecx
movq %rbx, %rdi
movl $0x5, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0xf6653
incq %r15
cmpq %r15, %rbp
jne 0x414a8
movq %rbx, %rdi
callq 0xf70f6
movq %r13, %rdi
leaq 0xd9c16(%rip), %rsi     # 0x11b0f9
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
callq 0xf6753
movq %r13, %r14
movq 0x18(%rsp), %rbx
movq 0x18(%r14), %rdi
movq 0x48(%rsp), %rcx
subq %rbp, %rcx
leaq 0x50(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x4197e
movl %eax, %ebp
cmpl $0x2, %eax
je 0x41555
cmpl $0x1, %ebp
jne 0x41900
movq %rbx, %r15
movq 0x50(%rsp), %r13
movl $0x50, %esi
leaq 0xb0(%rsp), %rdi
leaq 0xe829d(%rip), %rdx     # 0x1297e1
movq %r13, %rcx
xorl %eax, %eax
callq 0xe8193
movq 0x38(%rsp), %rbx
jmp 0x41586
movq %rbx, %r15
movq 0x18(%r14), %rax
movq 0x18(%rax), %r13
movq 0x38(%rsp), %rbx
subq %rbx, %r13
movq %r13, 0x50(%rsp)
movl $0x50, %edx
leaq 0xb0(%rsp), %rdi
leaq 0xd0f1b(%rip), %rsi     # 0x11249c
callq 0xe8219
movq 0x10(%rsp), %rax
decl %eax
leaq 0xeabbd(%rip), %r8      # 0x12c151
cmpb $0x7, %al
ja 0x415a9
movzbl %al, %eax
leaq 0xd9576(%rip), %rcx     # 0x11ab18
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
movq %r14, %rdi
leaq 0xd963a(%rip), %rsi     # 0x11abed
movq %rbx, %rdx
leaq 0xb0(%rsp), %rcx
xorl %eax, %eax
callq 0xe8617
cmpl $0x2, %ebp
je 0x418e4
leaq (%rbx,%r13), %rbp
movq 0x18(%r14), %rax
cmpq 0x18(%rax), %rbp
jg 0x418f7
cmpq 0x20(%rsp), %r12
jne 0x418b7
movl (%r15), %eax
btl $0x9, %eax
jb 0x418b7
movq %rbx, %rdx
btl $0x8, %eax
jae 0x41607
cmpl $0x2, (%r14)
jl 0x41680
movq %r15, %r12
movq 0x18(%r15), %rcx
testq %rcx, %rcx
je 0x41642
btl $0xb, %eax
setae %r15b
movq $0x0, 0x70(%rsp)
movq %rdx, %rbx
movq %rdx, 0x60(%rsp)
movq %r13, 0x68(%rsp)
movq %r14, %rdi
movq 0x28(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq *%rcx
jmp 0x41648
movq %rdx, %rbx
movb $0x1, %r15b
movzbl 0x10(%rsp), %eax
decl %eax
cmpl $0x7, %eax
ja 0x4177d
leaq 0xd9499(%rip), %rcx     # 0x11aaf8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x4131e
jmp 0x4188a
movq %r14, %rdi
leaq 0xd95e2(%rip), %rsi     # 0x11ac6c
xorl %eax, %eax
callq 0xe8617
jmp 0x418b7
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl $0x401, %ecx            # imm = 0x401
jmp 0x41804
cmpq $0x8, %r13
movq %rbx, %rsi
jne 0x4188d
movq 0x18(%r14), %rdi
movq %rsi, 0x20(%rsp)
callq 0xeee96
movq %r13, 0x10(%rsp)
movq %rax, %r13
movabsq $0x112e0be826d694b3, %rcx # imm = 0x112E0BE826D694B3
imulq %rcx
movb %r15b, 0xf(%rsp)
movq %rdx, %r15
movq %r12, 0x18(%rsp)
movq %rdx, %rbx
shrq $0x3f, %rbx
sarq $0x1a, %r15
leaq (%r15,%rbx), %rdi
addq $0x3a4fc880, %rdi       # imm = 0x3A4FC880
leaq 0xa0(%rsp), %r12
movq %r12, %rsi
movl $0x1, %edx
callq 0xea7f5
addq %rbx, %r15
imulq $0x3b9aca00, %r15, %rax # imm = 0x3B9ACA00
movb 0xf(%rsp), %r15b
movq %r13, %rcx
subq %rax, %rcx
cvtsi2sd %rcx, %xmm0
divsd 0xd93bd(%rip), %xmm0    # 0x11aaf0
movq %r12, %rdi
callq 0xea849
movl $0x40, %edx
movq %r12, %rdi
leaq 0x60(%rsp), %rbx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0xeaf46
movq %r14, %rdi
leaq 0xd1051(%rip), %rsi     # 0x1127ad
movq %r13, %rdx
movq 0x10(%rsp), %r13
movq %rbx, %rcx
movq 0x18(%rsp), %r12
xorl %eax, %eax
callq 0xe8617
movq 0x20(%rsp), %rsi
jmp 0x4188d
testb %r15b, %r15b
movq %rbx, %rsi
je 0x41892
jmp 0x418b7
testq %r13, %r13
movq %rbx, %rsi
je 0x4182a
leaq -0x9(%r13), %rax
cmpq $-0x8, %rax
jb 0x4188d
movb %r15b, 0xf(%rsp)
movq %r12, 0x18(%rsp)
leaq -0x8(,%r13,8), %r12
movq %rsi, 0x20(%rsp)
movq %rsi, %r15
movq %r13, 0x10(%rsp)
movq %r13, %rbx
xorl %r13d, %r13d
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xeead3
movzbl %al, %eax
movl %r12d, %ecx
andb $-0x8, %cl
shlq %cl, %rax
orq %rax, %r13
addq $-0x8, %r12
incq %r15
decq %rbx
jne 0x417cd
jmp 0x41841
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl $0x2, %ecx
callq 0x41a42
jmp 0x4188a
cmpq $0x8, %r13
movq %rbx, %rsi
je 0x4186b
cmpq $0x4, %r13
jne 0x4188d
movq 0x18(%r14), %rdi
movq %rsi, %rbx
xorl %edx, %edx
callq 0xef2fc
jmp 0x41879
movb %r15b, 0xf(%rsp)
movq %rsi, 0x20(%rsp)
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0xd98d0(%rip), %rsi     # 0x11b11b
movq %r13, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %r13
movq 0x20(%rsp), %rsi
movb 0xf(%rsp), %r15b
jmp 0x4188d
movq 0x18(%r14), %rdi
movq %rsi, %rbx
xorl %edx, %edx
callq 0xef39e
movq %r14, %rdi
leaq 0xd98a3(%rip), %rsi     # 0x11b126
movb $0x1, %al
callq 0xe8617
movq %rbx, %rsi
testb %r15b, %r15b
jne 0x418b7
movq $0x1, 0x70(%rsp)
movq %rsi, 0x60(%rsp)
movq %r13, 0x68(%rsp)
movq %r14, %rdi
movq 0x28(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq *0x18(%r12)
movl 0x40(%rsp), %esi
movq %r14, %rdi
callq 0xe8a25
cmpq 0x30(%rsp), %rbp
movq 0x48(%rsp), %r15
jg 0x4138c
jmp 0x41922
leaq 0xd92b6(%rip), %rsi     # 0x11ab92
movq %r14, %rdi
movq %rbp, %rdx
jmp 0x4190f
leaq 0xd9320(%rip), %rsi     # 0x11ac0b
movq %r14, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x41916
leaq 0xd9347(%rip), %rsi     # 0x11ac45
jmp 0x41907
leaq 0xd92be(%rip), %rsi     # 0x11abc5
movq %r14, %rdi
movq 0x30(%rsp), %rdx
xorl %eax, %eax
callq 0xe9295
movl 0x40(%rsp), %esi
movq %r14, %rdi
callq 0xe8a25
movl 0x44(%rsp), %esi
movq %r14, %rdi
callq 0xe8a25
movq 0x28(%rsp), %rax
decl (%rax)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq