// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/src/fmtutil.c
// Function: do_box_sequence
static void do_box_sequence(deark *c, struct de_boxesctx *bctx,
	i64 pos1, i64 len, i64 max_nboxes, int level)
{
	i64 pos;
	i64 box_len;
	i64 endpos;
	int ret;
	i64 box_count = 0;

	if(level >= 32) { // An arbitrary recursion limit.
		return;
	}

	pos = pos1;
	endpos = pos1 + len;

	while(pos < endpos) {
		if(max_nboxes>=0 && box_count>=max_nboxes) break;
		ret = do_box(c, bctx, pos, endpos-pos, level, &box_len);
		if(!ret) break;
		box_count++;
		pos += box_len;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, 0x58(%rsp)
movq %r9, 0x38(%rsp)
cmpl $0x1f, %r9d
jg 0xf874e
movq %rcx, %rbp
testq %rcx, %rcx
jle 0xf874e
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
addq %rdx, %rbp
movq 0x38(%rsp), %rax
incl %eax
movl %eax, 0x34(%rsp)
xorl %edx, %edx
movq %rsi, 0x28(%rsp)
movq %rdi, 0x10(%rsp)
movq %rbp, 0x50(%rsp)
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
sets %al
cmpq %rcx, %rdx
setl %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xf874e
movq %rdx, 0x60(%rsp)
subq %r15, %rbp
movq 0x8(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rbx), %r12
movl $0x78, %esi
movq %r14, %rdi
callq 0xe8b2b
movq %rax, 0x28(%rbx)
movq %r12, 0x40(%rsp)
movq %r12, (%rax)
movq %rbp, 0x18(%rsp)
cmpq $0x7, %rbp
jle 0xf86e8
movq %rax, %r13
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xeed0d
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq %r15, %rbp
leaq 0x4(%r15), %rsi
leaq 0x68(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1762
movl 0x6c(%rsp), %eax
movl %eax, 0xc(%r13)
cmpq $0x8, %r14
jl 0xf8481
addq $-0x8, %r14
movl $0x8, %ecx
movq %rbp, %r15
jmp 0xf84ea
cmpq $0x1, %r14
je 0xf84a3
testq %r14, %r14
jne 0xf8724
movq %rbp, %r15
movq 0x18(%rsp), %rcx
leaq -0x8(%rcx), %r14
movl $0x8, %ecx
jmp 0xf84ea
cmpq $0xf, 0x18(%rsp)
movq %rbp, %r15
jbe 0xf8760
movq 0x10(%rbx), %rdi
leaq 0x8(%r15), %rsi
callq 0xeee96
movq %rax, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xebad2
movq 0x48(%rsp), %r14
cmpq $0x10, %r14
jl 0xf8737
addq $-0x10, %r14
movl 0xc(%r13), %eax
movl $0x10, %ecx
cmpl $0x75756964, %eax       # imm = 0x75756964
jne 0xf851d
cmpq $0xf, %r14
jbe 0xf851d
movl $0x1, 0x10(%r13)
movq 0x10(%rbx), %rdi
leaq 0x14(%r13), %rsi
movq %rcx, %rbp
leaq (%rcx,%r15), %rbx
movl $0x10, %ecx
movq %rbx, %rdx
callq 0xee8d4
jmp 0xf8524
movq %rcx, %rbp
leaq (%rcx,%r15), %rbx
addq %r14, %rbp
movq 0x38(%rsp), %rcx
movl %ecx, 0x8(%r13)
movq %r15, 0x28(%r13)
movq %rbp, 0x30(%r13)
movq %rbx, 0x38(%r13)
movq %r14, 0x40(%r13)
cmpl $0x0, 0x10(%r13)
movq %rbp, %r12
je 0xf855a
addq $0x10, %rbx
movq %rbx, 0x38(%r13)
leaq -0x10(%r14), %rax
movq %rax, 0x40(%r13)
movq 0x28(%rsp), %rbx
movq 0x18(%rbx), %rax
testq %rax, %rax
movq 0x10(%rsp), %rbp
je 0xf8575
movq %rbp, %rdi
movq %rbx, %rsi
callq *%rax
cmpl $0x0, (%rbp)
movq 0x50(%rsp), %rbp
jle 0xf861f
movq 0x50(%r13), %rcx
testq %rcx, %rcx
je 0xf85a7
movl $0x50, %esi
movq 0x20(%rsp), %rdi
leaq 0x33870(%rip), %rdx     # 0x12be0e
xorl %eax, %eax
callq 0xe8193
jmp 0xf85af
movq 0x20(%rsp), %rax
movb $0x0, (%rax)
cmpl $0x0, 0x10(%r13)
je 0xf85f8
movq %r13, %rsi
addq $0x14, %rsi
movq 0x20(%rsp), %r14
leaq 0x50(%r14), %rbx
movl $0x32, %ecx
movq %rbx, %rdx
callq 0xf808d
movq %r12, (%rsp)
movq 0x10(%rsp), %rdi
leaq 0x52417(%rip), %rsi     # 0x14a9fa
leaq 0x78(%rsp), %rdx
movq %rbx, %rcx
movq 0x28(%rsp), %rbx
movq %r14, %r8
movq %r15, %r9
jmp 0xf8618
movq %r14, (%rsp)
movq 0x10(%rsp), %rdi
leaq 0x52411(%rip), %rsi     # 0x14aa19
leaq 0x78(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0xe8617
cmpq 0x18(%rsp), %r12
ja 0xf8703
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r14, %rdi
movq %rbx, %rsi
callq *0x20(%rbx)
movl %eax, %ebx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
testl %ebx, %ebx
movq 0x28(%rsp), %rbx
je 0xf8737
cmpl $0x0, 0x5c(%r13)
movq 0x10(%rsp), %r14
je 0xf86bd
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpl $0x0, 0x60(%r13)
je 0xf8687
movq 0x68(%r13), %r8
jmp 0xf868e
movq $-0x1, %r8
movq 0x40(%r13), %rcx
movq 0x70(%r13), %rax
movq 0x38(%r13), %rdx
addq %rax, %rdx
subq %rax, %rcx
movq %r14, %rdi
movq %rbx, %rsi
movl 0x34(%rsp), %r9d
callq 0xf8384
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0xe8be2
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x60(%rsp), %rdx
incq %rdx
addq %r12, %r15
cmpq %rbp, %r15
jl 0xf83dd
jmp 0xf874e
leaq 0x522c8(%rip), %rsi     # 0x14a9b7
movq %r14, %rdi
movq 0x18(%rsp), %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe8617
jmp 0xf8737
addq %r15, %r12
leaq 0x52331(%rip), %rsi     # 0x14aa3e
movq 0x10(%rsp), %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0xe9295
jmp 0xf8737
leaq 0x522ad(%rip), %rsi     # 0x14a9d8
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xe9295
movq 0x28(%rbx), %rsi
movq 0x10(%rsp), %rdi
callq 0xe8be2
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rbx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52250(%rip), %rsi     # 0x14a9b7
movq 0x10(%rsp), %rdi
jmp 0xf86f2