// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/src/deark-util.c
// Function: de_hexdump_internal
static void de_hexdump_internal(deark *c, struct hexdump_ctx *hctx,
	dbuf *f, i64 pos1,
	i64 nbytes_avail, i64 max_nbytes_to_dump)
{
	i64 pos = pos1;
	i64 len;
	int ndigits_for_offset;
	int was_truncated = 0;

	if(hctx->flags & 0x2) {
		// Don't print a prefix
		hctx->prefix = "";
		hctx->prefix_sep = "";
	}
	else {
		hctx->prefix_sep = ":";
	}

	if(nbytes_avail > max_nbytes_to_dump) {
		len = max_nbytes_to_dump;
		was_truncated = 1;
	}
	else {
		len = nbytes_avail;
	}

	// Construct a format string to use for byte offsets.
	if(was_truncated) {
		// If we're truncating, the highest offset we'll print is the number
		// of data bytes that we'll dump.
		ndigits_for_offset = get_ndigits_for_offset(len);
	}
	else {
		if(len<1) return;

		// If we're not truncating, the highest offset we'll print is the
		// highest byte offset that is a multiple of 16.
		ndigits_for_offset = get_ndigits_for_offset(((len-1)/16)*16);
	}
	de_snprintf(hctx->offset_fmtstr, sizeof(hctx->offset_fmtstr), "%%%d"I64_FMT, ndigits_for_offset);

	while(1) { // For each row...
		if(pos >= pos1+len) break;

		hctx->row_offset = pos-pos1;

		hctx->bytesthisrow = (pos1+len)-pos;
		if(hctx->bytesthisrow>16) hctx->bytesthisrow=16;

		dbuf_read(f, hctx->rowbuf, pos, hctx->bytesthisrow);

		do_hexdump_row(c, hctx);

		pos += hctx->bytesthisrow;
	}
	if(was_truncated) {
		de_snprintf(hctx->outbuf_sz, sizeof(hctx->outbuf_sz),
			"%s%s%"I64_FMT": ...", hctx->prefix, hctx->prefix_sep, len);
		hctx->printlinefn(c, hctx);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rcx, 0x18(%rsp)
movq %rdx, 0x48(%rsp)
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
testb $0x2, 0x10(%rsi)
jne 0xe8c7c
leaq 0x63c6d(%rip), %rax     # 0x14c8e7
jmp 0xe8c86
leaq 0x5d62d(%rip), %rax     # 0x1462b0
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
movq %r9, %r14
cmpq %r9, %r8
cmovlq %r8, %r14
jle 0xe8cc3
movl $0x1, %ecx
cmpq $0xa, %r9
jl 0xe8d04
movl $0x2, %ecx
cmpq $0x64, %r9
jb 0xe8d04
movl $0x3, %ecx
cmpq $0x3e8, %r9             # imm = 0x3E8
jb 0xe8d04
cmpq $0x2710, %r9            # imm = 0x2710
jmp 0xe8cf5
testq %r8, %r8
jle 0xe8f22
leaq -0x1(%r8), %rax
andq $-0x10, %rax
je 0xe8cff
movl $0x2, %ecx
cmpq $0x64, %rax
jb 0xe8d04
movl $0x3, %ecx
cmpq $0x3e8, %rax            # imm = 0x3E8
jb 0xe8d04
cmpq $0x2711, %r8            # imm = 0x2711
movl $0x5, %ecx
sbbl $0x0, %ecx
jmp 0xe8d04
movl $0x1, %ecx
movq %r8, 0x28(%rsp)
movq %r9, 0x30(%rsp)
leaq 0x20(%rbx), %rdi
leaq 0x5d838(%rip), %rdx     # 0x146551
movl $0x20, %esi
movq %rdi, 0x40(%rsp)
xorl %eax, %eax
callq 0xe8193
testq %r14, %r14
jle 0xe8eed
movq 0x18(%rsp), %r13
addq %r13, %r14
leaq 0x50(%rbx), %r15
leaq 0x60(%rbx), %rcx
movq %rcx, 0x38(%rsp)
movq %r14, 0x8(%rsp)
movq %r13, %rax
subq 0x18(%rsp), %rax
movq %rax, 0x40(%rbx)
movq %r14, %rcx
subq %r13, %rcx
cmpq $0x10, %rcx
movl $0x10, %eax
cmovgeq %rax, %rcx
movq %rcx, 0x48(%rbx)
movq 0x48(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xee8d4
movb $0x22, 0x50(%rsp)
cmpq $0x0, 0x48(%rbx)
jle 0xe8e22
movq %r13, 0x20(%rsp)
movl $0x1, %ebp
xorl %r12d, %r12d
xorl %r14d, %r14d
movzbl (%r15,%r14), %r13d
movl %r13d, %edi
shrl $0x4, %edi
callq 0xebba8
movb %al, 0x90(%rsp,%r12)
movl %r13d, %edi
andl $0xf, %edi
callq 0xebba8
movb %al, 0x91(%rsp,%r12)
movb $0x20, 0x92(%rsp,%r12)
leal -0x20(%r13), %ecx
movslq %ebp, %rax
leaq 0x1(%rax), %rbp
cmpb $0x5f, %cl
jb 0xe8df9
movb $0x2e, 0x50(%rsp,%rbp)
leal 0x3(%rax), %ebp
leaq 0x50(%rsp), %rcx
movb $0x2, 0x2(%rax,%rcx)
movb $0x1, %r13b
movb %r13b, 0x50(%rsp,%rax)
incq %r14
addq $0x3, %r12
cmpq 0x48(%rbx), %r14
jl 0xe8da0
leaq -0x3(%r12), %rax
cmpq $0x2c, %rax
ja 0xe8e52
movq 0x8(%rsp), %r14
movq 0x20(%rsp), %r13
jmp 0xe8e2a
movl $0x1, %ebp
xorl %r12d, %r12d
movl %r12d, %eax
leaq (%rsp,%rax), %rdi
addq $0x90, %rdi
movl $0x30, %edx
subl %r12d, %edx
movl $0x20, %esi
callq 0x18140
movl $0x30, %r12d
jmp 0xe8e5c
movq 0x8(%rsp), %r14
movq 0x20(%rsp), %r13
movl %r12d, %eax
movb $0x0, 0x90(%rsp,%rax)
testb $0x1, 0x10(%rbx)
jne 0xe8e74
movb $0x0, 0x50(%rsp)
jmp 0xe8e7e
movslq %ebp, %rax
movw $0x22, 0x50(%rsp,%rax)
movq 0x40(%rbx), %rcx
movl $0x20, %esi
leaq 0xe0(%rsp), %r12
movq %r12, %rdi
movq 0x40(%rsp), %rdx
xorl %eax, %eax
callq 0xe8193
movq (%rbx), %rcx
movq 0x8(%rbx), %r8
movl $0xc8, %esi
movq 0x38(%rsp), %rdi
leaq 0x5d6af(%rip), %rdx     # 0x146565
movq %r12, %r9
xorl %eax, %eax
leaq 0x50(%rsp), %r10
pushq %r10
leaq 0x98(%rsp), %r10
pushq %r10
callq 0xe8193
addq $0x10, %rsp
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq *0x18(%rbx)
addq 0x48(%rbx), %r13
cmpq %r14, %r13
jl 0xe8d4d
movq 0x30(%rsp), %r9
cmpq %r9, 0x28(%rsp)
jle 0xe8f22
leaq 0x60(%rbx), %rdi
movq (%rbx), %rcx
movq 0x8(%rbx), %r8
leaq 0x5d64d(%rip), %rdx     # 0x146558
movl $0xc8, %esi
xorl %eax, %eax
callq 0xe8193
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq *0x18(%rbx)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq