// File: /workspace/github_c_makefile_star2_O2/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, 0x10(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
testb $0x2, 0x10(%rsi)
jne 0xdedcc
leaq 0x6061d(%rip), %rax     # 0x13f3e7
jmp 0xdedd6
leaq 0x5a00d(%rip), %rax     # 0x138de0
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
movq %r9, %r13
movq %r9, %rdi
cmpq %r9, %r8
cmovlq %r8, %r13
jg 0xdedfa
testq %r8, %r8
jle 0xdefd2
leaq -0x1(%r8), %rdi
andq $-0x10, %rdi
movq %r8, 0x18(%rsp)
movq %r9, 0x20(%rsp)
callq 0xe1180
leaq 0x20(%rbx), %rdi
leaq 0x5a26d(%rip), %rdx     # 0x139081
pushq $0x20
popq %rsi
movq %rdi, 0x30(%rsp)
movl %eax, %ecx
xorl %eax, %eax
callq 0xde40c
movq 0x10(%rsp), %rax
addq %rax, %r13
leaq 0x50(%rbx), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x60(%rbx), %rcx
movq %rcx, (%rsp)
leaq 0x50(%rsp), %r12
movq %rax, %rdx
movq %r13, 0x38(%rsp)
movq %r13, %rcx
subq %rdx, %rcx
jle 0xdef9d
movq %rdx, %rax
subq 0x10(%rsp), %rax
movq %rax, 0x40(%rbx)
cmpq $0x10, %rcx
pushq $0x10
popq %rax
cmovgeq %rax, %rcx
movq %rcx, 0x48(%rbx)
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rdx, 0x48(%rsp)
callq 0xe3cb7
movb $0x22, 0x50(%rsp)
xorl %r15d, %r15d
xorl %ebp, %ebp
pushq $0x1
popq %rax
movslq %eax, %r14
cmpq 0x48(%rbx), %rbp
jge 0xdeefe
movzbl 0x50(%rbx,%rbp), %r13d
movl %r13d, %edi
shrl $0x4, %edi
callq 0xe11b0
movb %al, 0x90(%rsp,%r15)
movl %r13d, %edi
andl $0xf, %edi
callq 0xe11b0
movb %al, 0x91(%rsp,%r15)
movb $0x20, 0x92(%rsp,%r15)
leal -0x20(%r13), %ecx
leaq 0x1(%r14), %rax
cmpb $0x5f, %cl
jb 0xdeef0
movb $0x2e, 0x50(%rsp,%rax)
leal 0x3(%r14), %eax
movb $0x2, 0x2(%r14,%r12)
movb $0x1, %r13b
movb %r13b, 0x50(%rsp,%r14)
incq %rbp
addq $0x3, %r15
jmp 0xdee93
movq 0x38(%rsp), %r13
cmpq $0x2f, %r15
ja 0xdef17
movb $0x20, 0x90(%rsp,%r15)
incq %r15
jmp 0xdef03
movl %r15d, %eax
movb $0x0, 0x90(%rsp,%rax)
testb $0x1, 0x10(%rbx)
jne 0xdef2f
movb $0x0, 0x50(%rsp)
jmp 0xdef37
movw $0x22, 0x50(%rsp,%r14)
movq 0x40(%rbx), %rcx
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
pushq $0x20
popq %rsi
movq 0x30(%rsp), %rdx
xorl %eax, %eax
callq 0xde40c
movq (%rbx), %rcx
movq 0x8(%rbx), %r8
movl $0xc8, %esi
movq (%rsp), %rdi
leaq 0x5a129(%rip), %rdx     # 0x139095
movq %r14, %r9
xorl %eax, %eax
pushq %r12
leaq 0x98(%rsp), %r10
pushq %r10
callq 0xde40c
popq %rax
popq %rcx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq *0x18(%rbx)
movq 0x48(%rsp), %rdx
addq 0x48(%rbx), %rdx
jmp 0xdee4b
movq 0x20(%rsp), %r9
cmpq %r9, 0x18(%rsp)
jle 0xdefd2
movq (%rbx), %rcx
movq 0x8(%rbx), %r8
leaq 0x5a0d1(%rip), %rdx     # 0x139088
movl $0xc8, %esi
movq (%rsp), %rdi
xorl %eax, %eax
callq 0xde40c
movq 0x8(%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