// File: /workspace/github_c_makefile_star2_O1/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, 0x50(%rsp)
movq %rdi, 0x8(%rsp)
movq %r9, 0x38(%rsp)
cmpl $0x1f, %r9d
jg 0xf8c50
movq %rcx, %r15
testq %rcx, %rcx
jle 0xf8c50
movq %rdx, %r12
movq %rsi, %r13
addq %rdx, %r15
movq 0x38(%rsp), %rax
incl %eax
movl %eax, 0x34(%rsp)
xorl %edx, %edx
movq %rsi, 0x28(%rsp)
movq %r15, 0x18(%rsp)
movq 0x50(%rsp), %rcx
testq %rcx, %rcx
sets %al
cmpq %rcx, %rdx
setl %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xf8c50
movq %rdx, 0x60(%rsp)
subq %r12, %r15
movq 0x8(%r13), %rax
movq %rax, 0x40(%rsp)
movq 0x28(%r13), %rbp
movl $0x78, %esi
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xe969b
movq %rax, 0x28(%r13)
movq %rbp, 0x58(%rsp)
movq %rbp, (%rax)
cmpq $0x7, %r15
jg 0xf893e
movq %r14, %rdi
leaq 0x51ae8(%rip), %rsi     # 0x14a407
movl %r15d, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
movb $0x1, %r13b
movq 0x20(%rsp), %rbp
movq 0x18(%rsp), %r15
jmp 0xf8c15
movq %rax, %rbx
movq 0x10(%r13), %rdi
movq %r12, %rsi
callq 0xef32a
movq %rax, %rbp
movq 0x10(%r13), %rdi
leaq 0x4(%r12), %rsi
leaq 0x68(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
movl 0x6c(%rsp), %eax
movl %eax, 0xc(%rbx)
cmpq $0x8, %rbp
jl 0xf897e
addq $-0x8, %rbp
jmp 0xf8995
cmpq $0x1, %rbp
je 0xf8a53
testq %rbp, %rbp
jne 0xf8a9b
leaq -0x8(%r15), %rbp
movl $0x8, %r13d
cmpl $0x75756964, 0xc(%rbx)  # imm = 0x75756964
jne 0xf89cc
cmpq $0x10, %rbp
jl 0xf89cc
movl $0x1, 0x10(%rbx)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x14(%rbx), %rsi
leaq (%r12,%r13), %rdx
movl $0x10, %ecx
callq 0xeeee8
movq %r13, %rcx
addq %rbp, %rcx
movq 0x38(%rsp), %rax
movl %eax, 0x8(%rbx)
movq %r12, 0x28(%rbx)
movq %rcx, 0x10(%rsp)
movq %rcx, 0x30(%rbx)
addq %r12, %r13
movq %r13, 0x38(%rbx)
movq %rbp, 0x40(%rbx)
cmpl $0x0, 0x10(%rbx)
je 0xf8a08
addq $0x10, %r13
movq %r13, 0x38(%rbx)
leaq -0x10(%rbp), %rax
movq %rax, 0x40(%rbx)
movq 0x28(%rsp), %r13
movq 0x18(%r13), %rax
testq %rax, %rax
movq 0x8(%rsp), %r14
je 0xf8a23
movq %r14, %rdi
movq %r13, %rsi
callq *%rax
cmpl $0x0, (%r14)
jle 0xf8b24
movq 0x50(%rbx), %rcx
testq %rcx, %rcx
je 0xf8ab1
movl $0x50, %esi
movq 0x40(%rsp), %r14
movq %r14, %rdi
leaq 0x330dc(%rip), %rdx     # 0x12bb26
xorl %eax, %eax
callq 0xe8d67
jmp 0xf8aba
cmpq $0xf, %r15
jle 0xf8915
movq 0x10(%r13), %rdi
leaq 0x8(%r12), %rsi
callq 0xef4c3
movq %rax, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xec0d1
movq 0x48(%rsp), %rbp
movb $0x1, %r13b
cmpq $0x10, %rbp
jl 0xf892f
addq $-0x10, %rbp
movl $0x10, %r13d
jmp 0xf899b
movq %r14, %rdi
leaq 0x51983(%rip), %rsi     # 0x14a428
xorl %eax, %eax
callq 0xe9df7
jmp 0xf892c
movq 0x40(%rsp), %r14
movb $0x0, (%r14)
cmpl $0x0, 0x10(%rbx)
je 0xf8afd
movq %rbx, %rsi
addq $0x14, %rsi
leaq 0x50(%r14), %rbp
movl $0x32, %ecx
movq %rbp, %rdx
callq 0xf8559
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
leaq 0x5195d(%rip), %rsi     # 0x14a44a
leaq 0x78(%rsp), %rdx
movq %rbp, %rcx
movq %r14, %r8
movq %r12, %r9
jmp 0xf8b1d
movq %rbp, (%rsp)
movq 0x8(%rsp), %rdi
leaq 0x5195c(%rip), %rsi     # 0x14a469
leaq 0x78(%rsp), %rdx
movq %r14, %rcx
movq %r12, %r8
movq 0x10(%rsp), %r9
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rsp), %rcx
cmpq %r15, %rcx
jle 0xf8b5f
addq %r12, %rcx
movq 0x8(%rsp), %r14
movq %r14, %rdi
leaq 0x5194e(%rip), %rsi     # 0x14a48e
movq %r12, %rdx
movq 0x18(%rsp), %r15
movq %r15, %r8
xorl %eax, %eax
callq 0xe9df7
movb $0x1, %r13b
movq 0x20(%rsp), %rbp
jmp 0xf8c15
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r14, %rdi
movq %r13, %rsi
callq *0x20(%r13)
movl %eax, %ebp
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
testl %ebp, %ebp
movq 0x18(%rsp), %r15
je 0xf8bb4
cmpl $0x0, 0x5c(%rbx)
je 0xf8bc3
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0xe9585
cmpl $0x0, 0x60(%rbx)
je 0xf8bd2
movq 0x68(%rbx), %r8
jmp 0xf8bd9
movb $0x1, %r13b
movq 0x20(%rsp), %rbp
movq 0x8(%rsp), %r14
jmp 0xf8c15
xorl %r13d, %r13d
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %rbp
jmp 0xf8c15
movq $-0x1, %r8
movq 0x10(%rsp), %rbp
movq 0x40(%rbx), %rcx
movq 0x70(%rbx), %rax
movq 0x38(%rbx), %rdx
addq %rax, %rdx
subq %rax, %rcx
movq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movl 0x34(%rsp), %r9d
callq 0xf886a
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
xorl %r13d, %r13d
movq 0x28(%rsp), %rbx
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0xe9752
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rbx)
testb %r13b, %r13b
movq 0x60(%rsp), %rdx
jne 0xf8c50
movq %rbx, %r13
incq %rdx
addq %rbp, %r12
movq %rbp, 0x20(%rsp)
cmpq %r15, %r12
jl 0xf88c0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq